Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
fix(controller): only load latest config
Browse files Browse the repository at this point in the history
Only load latest config for each app from db to k8s on boot
  • Loading branch information
jgmize authored and mboersma committed Aug 2, 2016
1 parent 6d6a10e commit bab3632
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions rootfs/api/management/commands/load_db_state_to_k8s.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.core.management.base import BaseCommand
from django.shortcuts import get_object_or_404

from api.models import Key, App, Domain, Certificate, Config
from api.models import Key, App, Domain, Certificate
from api.exceptions import DeisException, AlreadyExists


Expand All @@ -12,7 +12,14 @@ class Command(BaseCommand):
def handle(self, *args, **options):
"""Publishes Deis platform state from the database to kubernetes."""
print("Publishing DB state to kubernetes...")
for model in (Key, App, Domain, Certificate, Config):
for app in App.objects.all():
try:
app.save()
app.config_set.latest().save()
except DeisException as error:
print('ERROR: Problem saving to model {} for {}'
'due to {}'.format(str(App.__name__), str(app), str(error)))
for model in (Key, Domain, Certificate):
for obj in model.objects.all():
try:
obj.save()
Expand Down

0 comments on commit bab3632

Please sign in to comment.