Skip to content

Commit

Permalink
fix(controller): only load latest config
Browse files Browse the repository at this point in the history
Fix deis#5017: only load latest config for each app from db to etcd on boot
  • Loading branch information
jgmize committed May 3, 2016
1 parent a44e04a commit 998295a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions controller/api/management/commands/load_db_state_to_etcd.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from __future__ import print_function

from django.core.management.base import BaseCommand

from api.models import Key, App, Domain, Certificate, Config
from api.models import Key, App, Domain, Certificate


class Command(BaseCommand):
Expand All @@ -9,8 +11,11 @@ class Command(BaseCommand):
"""
def handle(self, *args, **options):
"""Publishes Deis platform state from the database to etcd."""
print "Publishing DB state to etcd..."
for model in (Key, App, Domain, Certificate, Config):
print("Publishing DB state to etcd...")
for app in App.objects.all():
app.save()
app.config_set.latest().save()
for model in (Key, Domain, Certificate):
for obj in model.objects.all():
obj.save()
print "Done Publishing DB state to etcd."
print("Done Publishing DB state to etcd.")

0 comments on commit 998295a

Please sign in to comment.