Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class DidNotChangeStatus(SkippedStatus):
reason = "nochange"
class StackDoesNotExist(SkippedStatus):
reason = "does not exist in cloudformation"
PENDING = PendingStatus()
WAITING = PendingStatus(reason="waiting")
SUBMITTED = SubmittedStatus()
COMPLETE = CompleteStatus()
SKIPPED = SkippedStatus()
FAILED = FailedStatus()
INTERRUPTED = FailedStatus(reason="interrupted")
return old_status
elif provider.is_stack_destroyed(provider_stack):
logger.debug("Stack %s finished deleting", stack.fqn)
recreate = True
# Continue with creation afterwards
# Failure must be checked *before* completion, as both will be true
# when completing a rollback, and we don't want to consider it as
# a successful update.
elif provider.is_stack_failed(provider_stack):
reason = old_status.reason
if 'rolling' in reason:
reason = reason.replace('rolling', 'rolled')
status_reason = provider.get_rollback_status_reason(stack.fqn)
logger.info(
"%s Stack Roll Back Reason: " + status_reason, stack.fqn)
return FailedStatus(reason)
elif provider.is_stack_completed(provider_stack):
stack.set_outputs(
provider.get_output_dict(provider_stack))
return CompleteStatus(old_status.reason)
else:
return old_status
logger.debug("Resolving stack %s", stack.fqn)
stack.resolve(self.context, self.provider)
logger.debug("Launching stack %s now.", stack.fqn)
template = self._template(stack.blueprint)
stack_policy = self._stack_policy(stack)
tags = build_stack_tags(stack)
parameters = self.build_parameters(stack, provider_stack)
def walk_func(step):
# Before we execute the step, we need to ensure that it's
# transitive dependencies are all in an "ok" state. If not, we
# won't execute this step.
for dep in self.graph.downstream(step.name):
if not dep.ok:
step.set_status(FailedStatus("dependency has failed"))
return step.ok
return step.run()
def _run_once(self):
try:
status = self.fn(self.stack, status=self.status)
except Exception as e:
logger.exception(e)
status = FailedStatus(reason=str(e))
self.set_status(status)
return status
class DidNotChangeStatus(SkippedStatus):
reason = "nochange"
class StackDoesNotExist(SkippedStatus):
reason = "does not exist in cloudformation"
PENDING = PendingStatus()
WAITING = PendingStatus(reason="waiting")
SUBMITTED = SubmittedStatus()
COMPLETE = CompleteStatus()
SKIPPED = SkippedStatus()
FAILED = FailedStatus()
INTERRUPTED = FailedStatus(reason="interrupted")
def walk_func(step):
# Before we execute the step, we need to ensure that it's
# transitive dependencies are all in an "ok" state. If not, we
# won't execute this step.
for dep in self.graph.downstream(step.name):
if not dep.ok:
step.set_status(FailedStatus("dependency has failed"))
return step.ok
return step.run()
def __init__(self, reason=None):
super(FailedStatus, self).__init__("failed", 4, reason)