feat: handle non-existing stacks during delete gracefully, bump minimal Python to 3.9, latest Pulumi

master v0.16.0
Stefan Reimer 2 months ago
parent 893c49bbb0
commit 611dddb062
  1. 2
      Dockerfile
  2. 15
      cloudbender/cli.py
  3. 7
      cloudbender/stack.py
  4. 2
      pyproject.toml
  5. 2
      requirements.txt

@ -1,6 +1,6 @@
ARG RUNTIME_VERSION="3.10"
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
ARG PULUMI_VERSION

@ -445,7 +445,7 @@ def _provision(cb, stacks):
for step in sort_stacks(cb, stacks):
if step:
# Pulumi is not thread safe, so for now one by one
if _anyPulumi(step):
if _anyPulumi(step) and False:
for stack in step:
if stack.mode != "pulumi":
status = stack.get_status()
@ -462,11 +462,16 @@ def _provision(cb, stacks):
with ThreadPoolExecutor(max_workers=len(step)) as group:
futures = []
for stack in step:
status = stack.get_status()
if not status:
futures.append(group.submit(stack.create))
if stack.mode != "pulumi":
status = stack.get_status()
if not status:
futures.append(group.submit(stack.create))
else:
futures.append(group.submit(stack.update))
# Pulumi only needs "up"
else:
futures.append(group.submit(stack.update))
futures.append(group.submit(stack.create))
for future in as_completed(futures):
future.result()

@ -834,7 +834,12 @@ class Stack(object):
logger.info("Deleting {0} {1}".format(self.region, self.stackname))
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.workspace.remove_stack(pulumi_stack.name)

@ -11,7 +11,7 @@ authors = [
description = "Deploy and maintain infrastructure in automated and trackable manner"
readme = "README.md"
license = "AGPL-3.0-or-later"
requires-python = ">=3.8"
requires-python = ">=3.9"
dependencies = [
"boto3",
"mock",

@ -5,7 +5,7 @@ click
pexpect
python-minifier
cfn-lint>=0.34
pulumi>=3.38.0
pulumi>=3.40.1
pulumi-aws>5.0.0
pulumi-aws-native
pulumi-policy

Loading…
Cancel
Save