feat: handle non-existing stacks during delete gracefully, bump minimal Python to 3.9, latest Pulumi
This commit is contained in:
parent
893c49bbb0
commit
611dddb062
@ -1,6 +1,6 @@
|
|||||||
ARG RUNTIME_VERSION="3.10"
|
ARG RUNTIME_VERSION="3.10"
|
||||||
ARG DISTRO_VERSION="3.16"
|
ARG DISTRO_VERSION="3.16"
|
||||||
ARG PULUMI_VERSION="3.38.0"
|
ARG PULUMI_VERSION="3.40.1"
|
||||||
|
|
||||||
FROM python:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} AS builder
|
FROM python:${RUNTIME_VERSION}-alpine${DISTRO_VERSION} AS builder
|
||||||
ARG PULUMI_VERSION
|
ARG PULUMI_VERSION
|
||||||
|
@ -445,7 +445,7 @@ def _provision(cb, stacks):
|
|||||||
for step in sort_stacks(cb, stacks):
|
for step in sort_stacks(cb, stacks):
|
||||||
if step:
|
if step:
|
||||||
# Pulumi is not thread safe, so for now one by one
|
# Pulumi is not thread safe, so for now one by one
|
||||||
if _anyPulumi(step):
|
if _anyPulumi(step) and False:
|
||||||
for stack in step:
|
for stack in step:
|
||||||
if stack.mode != "pulumi":
|
if stack.mode != "pulumi":
|
||||||
status = stack.get_status()
|
status = stack.get_status()
|
||||||
@ -462,11 +462,16 @@ def _provision(cb, stacks):
|
|||||||
with ThreadPoolExecutor(max_workers=len(step)) as group:
|
with ThreadPoolExecutor(max_workers=len(step)) as group:
|
||||||
futures = []
|
futures = []
|
||||||
for stack in step:
|
for stack in step:
|
||||||
status = stack.get_status()
|
if stack.mode != "pulumi":
|
||||||
if not status:
|
status = stack.get_status()
|
||||||
futures.append(group.submit(stack.create))
|
if not status:
|
||||||
|
futures.append(group.submit(stack.create))
|
||||||
|
else:
|
||||||
|
futures.append(group.submit(stack.update))
|
||||||
|
|
||||||
|
# Pulumi only needs "up"
|
||||||
else:
|
else:
|
||||||
futures.append(group.submit(stack.update))
|
futures.append(group.submit(stack.create))
|
||||||
|
|
||||||
for future in as_completed(futures):
|
for future in as_completed(futures):
|
||||||
future.result()
|
future.result()
|
||||||
|
@ -834,7 +834,12 @@ class Stack(object):
|
|||||||
logger.info("Deleting {0} {1}".format(self.region, self.stackname))
|
logger.info("Deleting {0} {1}".format(self.region, self.stackname))
|
||||||
|
|
||||||
if self.mode == "pulumi":
|
if self.mode == "pulumi":
|
||||||
pulumi_stack = self._get_pulumi_stack()
|
try:
|
||||||
|
pulumi_stack = self._get_pulumi_stack()
|
||||||
|
except pulumi.automation.errors.StackNotFoundError:
|
||||||
|
logger.warning("Could not find Pulumi stack {}".format(self.stackname))
|
||||||
|
return
|
||||||
|
|
||||||
pulumi_stack.destroy(on_output=self._log_pulumi)
|
pulumi_stack.destroy(on_output=self._log_pulumi)
|
||||||
pulumi_stack.workspace.remove_stack(pulumi_stack.name)
|
pulumi_stack.workspace.remove_stack(pulumi_stack.name)
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ authors = [
|
|||||||
description = "Deploy and maintain infrastructure in automated and trackable manner"
|
description = "Deploy and maintain infrastructure in automated and trackable manner"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "AGPL-3.0-or-later"
|
license = "AGPL-3.0-or-later"
|
||||||
requires-python = ">=3.8"
|
requires-python = ">=3.9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"boto3",
|
"boto3",
|
||||||
"mock",
|
"mock",
|
||||||
|
@ -5,7 +5,7 @@ click
|
|||||||
pexpect
|
pexpect
|
||||||
python-minifier
|
python-minifier
|
||||||
cfn-lint>=0.34
|
cfn-lint>=0.34
|
||||||
pulumi>=3.38.0
|
pulumi>=3.40.1
|
||||||
pulumi-aws>5.0.0
|
pulumi-aws>5.0.0
|
||||||
pulumi-aws-native
|
pulumi-aws-native
|
||||||
pulumi-policy
|
pulumi-policy
|
||||||
|
Loading…
Reference in New Issue
Block a user