Commit ef8a0bd7 authored by lukas.burgey's avatar lukas.burgey

Publish more changes to DeploymentStates

parent c3056801
Pipeline #110563 passed with stage
in 1 minute and 23 seconds
......@@ -510,6 +510,9 @@ class DeploymentState(models.Model):
LOGGER.debug(self.msg('Patched by client: {} - {}'.format(self.state, self.message)))
if self.state == NOT_DEPLOYED and self.is_orphaned:
# publish one last time so the webpage displays "not_deployed"
self.publish_to_user()
LOGGER.debug(self.msg('Deleting'))
# don't delete 'self' but the DepState via its id
DeploymentState.objects.get(id=self.id).delete()
......@@ -551,17 +554,17 @@ class DeploymentState(models.Model):
QUESTIONNAIRE: self.publish_to_user, # needs answers
},
NOT_DEPLOYED: {
DEPLOYED: REMOVAL_PENDING, # needs to get removed
DEPLOYMENT_PENDING: NOT_DEPLOYED, # aborting a deployment
DEPLOYED: [REMOVAL_PENDING, self.publish_to_user, self.publish_to_client], # needs to get removed
DEPLOYMENT_PENDING: [NOT_DEPLOYED, self.publish_to_user], # aborting a deployment
NOT_DEPLOYED: None, # already reached correct state
REMOVAL_PENDING: None, # already on the way to the correct state
# these four states indicate that the last deployment run was not successful
# we therefore can turn around an say that the we reached the NOT_DEPLOYED state
FAILED: NOT_DEPLOYED,
FAILED_PERMANENTLY: NOT_DEPLOYED,
REJECTED: NOT_DEPLOYED,
QUESTIONNAIRE: NOT_DEPLOYED,
FAILED: [NOT_DEPLOYED, self.publish_to_user],
FAILED_PERMANENTLY: [NOT_DEPLOYED, self.publish_to_user],
REJECTED: [NOT_DEPLOYED, self.publish_to_user],
QUESTIONNAIRE: [NOT_DEPLOYED, self.publish_to_user],
},
}
self._apply_transition(state_transitions)
......@@ -626,6 +629,7 @@ class DeploymentState(models.Model):
# same state
if self.state != state:
LOGGER.debug(self.msg('Target: {} | State: {} -> {}'.format(self.state_target, self.state, state)))
self.state = state
# reset the failed attempts if not failure
......@@ -634,8 +638,6 @@ class DeploymentState(models.Model):
self.save()
LOGGER.debug(self.msg('Target: {} | State: {} -> {}'.format(self.state_target, self.state, state)))
if publish_to_user:
self.publish_to_user()
......
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