Commit fbf2c756 authored by Lukas Burgey's avatar Lukas Burgey

Make minor changes to the DeploymentStateItems

parent 0af95896
......@@ -47,6 +47,7 @@ class DeploymentStateItemSerializer(serializers.ModelSerializer):
'service',
#'services',
'group',
'message',
]
......
......@@ -757,8 +757,6 @@ class Deployment(models.Model):
for state in self.states.all():
state.service_added(service)
# remove key and track changes in the key lists
def remove_key(self, key):
if not self.is_active:
......@@ -1000,17 +998,21 @@ class DeploymentStateItem(models.Model):
# message for the user
message = models.TextField(
max_length=300,
blank=True,
default='',
)
# questions for the user (needed for deployment
questionnaire = JSONField(
default=questionnaire_default,
null=True,
blank=True,
)
# credentials for the service
# only valid when state == deployed
credentials = JSONField(
default=credential_default,
null=True,
blank=True,
)
@property
......@@ -1103,8 +1105,8 @@ class DeploymentStateItem(models.Model):
self.credentials = output.get('credentials', {})
self.save()
elif status == 'not_deployed':
self.credentials = credential_default()
self.questionnaire = questionnaire_default()
# reset credentials and questi
self._reset()
self.save()
elif status == 'questionnaire':
self.questionnaire = output.get('questionnaire', {})
......@@ -1114,13 +1116,19 @@ class DeploymentStateItem(models.Model):
elif status == 'failed':
pass
else:
return 'unknown state '+status
return 'unknown state \''+status+'\''
self._set_state(status)
return None
return 'missing status in output'
# resets all client sent values
def _reset(self):
self.credentials = credential_default()
self.questionnaire = questionnaire_default()
self.message = ''
def msg(self, msg):
return '[DSItem:{}] {}'.format(self, msg)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment