Skip to content

Commit bab3632

Browse files
jgmizemboersma
authored andcommitted
fix(controller): only load latest config
Only load latest config for each app from db to k8s on boot
1 parent 6d6a10e commit bab3632

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

rootfs/api/management/commands/load_db_state_to_k8s.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from django.core.management.base import BaseCommand
22
from django.shortcuts import get_object_or_404
33

4-
from api.models import Key, App, Domain, Certificate, Config
4+
from api.models import Key, App, Domain, Certificate
55
from api.exceptions import DeisException, AlreadyExists
66

77

@@ -12,7 +12,14 @@ class Command(BaseCommand):
1212
def handle(self, *args, **options):
1313
"""Publishes Deis platform state from the database to kubernetes."""
1414
print("Publishing DB state to kubernetes...")
15-
for model in (Key, App, Domain, Certificate, Config):
15+
for app in App.objects.all():
16+
try:
17+
app.save()
18+
app.config_set.latest().save()
19+
except DeisException as error:
20+
print('ERROR: Problem saving to model {} for {}'
21+
'due to {}'.format(str(App.__name__), str(app), str(error)))
22+
for model in (Key, Domain, Certificate):
1623
for obj in model.objects.all():
1724
try:
1825
obj.save()

0 commit comments

Comments
 (0)