Skip to content

Commit

Permalink
Merge pull request #15 from sjones4/issue-esi-manage-rollback
Browse files Browse the repository at this point in the history
esi-manage-stack better handling for stack failure states
  • Loading branch information
obino authored Aug 26, 2020
2 parents edb653f + a2eb6de commit f675980
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions bin/esi-manage-stack
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,13 @@ class StackManager(EsiBase):
"'services.{2}.worker.configured' property is set to 'false'. That is not a valid state." \
"Please resolve this conflict".format(state["name"], stack, stack)
self.set_property(False, stack)
elif state["status"] in ('CREATE_FAILED', 'ROLLBACK_COMPLETE'):
if 'false' == self._get_property('services.{0}.worker.configured'.format(stack)):
# looks like a stack was created manually so the problem should be resolved manually
print "Detected failed stack {0} in the {1} service account, at the same time " \
"'services.{2}.worker.configured' property is set to 'false'. That is not a valid state." \
"Please resolve this conflict".format(state["name"], stack, stack)
self.set_property(False, stack)
elif state["status"] == 'DELETE_IN_PROGRESS':
print "Stack '{0}' is already in {1} state.".format(state["name"], state["status"])
elif state["status"] == 'CREATE_IN_PROGRESS':
Expand Down Expand Up @@ -128,8 +135,9 @@ class StackManager(EsiBase):
r.logical_resource_id, r.physical_resource_id, state["name"])
elif stack_status == 'NOT_FOUND':
print "Can not detect stack status for {0} service".format(stack)
elif stack_status == 'CREATE_FAILED':
print 'Stack creation failed. You need to check system logs for errors.'
elif stack_status in ('CREATE_FAILED', 'ROLLBACK_COMPLETE'):
print ('Stack creation failed. Please check system logs and stack events for errors.\n'
'Delete and re-create stack to try again.')
else:
print "Stack '{0}' currently is in {1} state.".format(state["name"], stack_status)

Expand Down

0 comments on commit f675980

Please sign in to comment.