Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
feudal
feudalBackend
Commits
ef8a0bd7
Commit
ef8a0bd7
authored
Sep 23, 2020
by
lukas.burgey
Browse files
Publish more changes to DeploymentStates
parent
c3056801
Pipeline
#110563
passed with stage
in 1 minute and 23 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
feudal/backend/models/deployments.py
View file @
ef8a0bd7
...
...
@@ -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
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment