Skip to content

Commit d0572e0

Browse files
committed
Merge pull request #805 from helgi/fix_config_set
fix(config): when rolling a new config copy from the latest release instead of latest config for the app
2 parents 9d98a79 + 5fb1bbb commit d0572e0

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

rootfs/api/models/config.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from django.db import models
33
from jsonfield import JSONField
44

5+
from api.models.release import Release
56
from api.models import UuidAuditedModel, DeisException
67

78

@@ -110,7 +111,14 @@ def set_tags(self, previous_config):
110111
def save(self, **kwargs):
111112
"""merge the old config with the new"""
112113
try:
113-
previous_config = self.app.config_set.latest()
114+
# Get config from the latest available release
115+
try:
116+
previous_config = self.app.release_set.latest().config
117+
except Release.DoesNotExist:
118+
# If that doesn't exist then fallback on app config
119+
# usually means a totally new app
120+
previous_config = self.app.config_set.latest()
121+
114122
for attr in ['cpu', 'memory', 'tags', 'registry', 'values']:
115123
data = getattr(previous_config, attr, {}).copy()
116124
new_data = getattr(self, attr, {}).copy()

0 commit comments

Comments
 (0)