Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ def clean_all_integ_buckets():
@pytest.fixture()
def setup_companion_stack_once(tmpdir_factory, get_prefix):
tests_integ_dir = Path(__file__).resolve().parents[1]
template_foler = Path(tests_integ_dir, "integration", "setup")
companion_stack_tempalte_path = Path(template_foler, COMPANION_STACK_TEMPLATE)
template_folder = Path(tests_integ_dir, "integration", "setup")
companion_stack_template_path = Path(template_folder, COMPANION_STACK_TEMPLATE)
cfn_client = ClientProvider().cfn_client
output_dir = tmpdir_factory.mktemp("data")
stack_name = get_prefix + COMPANION_STACK_NAME
companion_stack = Stack(stack_name, companion_stack_tempalte_path, cfn_client, output_dir)
companion_stack = Stack(stack_name, companion_stack_template_path, cfn_client, output_dir)
companion_stack.create_or_update(_stack_exists(stack_name))


Expand Down
10 changes: 10 additions & 0 deletions integration/helpers/deployer/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,16 @@ def create_and_wait_for_changeset(
self.describe_changeset(result["Id"], stack_name)
return result
except deploy_exceptions.ChangeEmptyError:
try:
# Delete the most recent change set that failed to create because it was empty
changeset = sorted(
self._client.list_change_sets(StackName=stack_name).get("Summaries"),
key=lambda c: c["CreationTime"],
)[-1]
if changeset.get("Status") == "FAILED" and changeset.get("ExecutionStatus") == "UNAVAILABLE":
self._client.delete_change_set(ChangeSetName=changeset["ChangeSetId"], StackName=stack_name)
except Exception as ex:
LOG.warning("Failed to clean up empty changeset", exc_info=ex)
return {}
except botocore.exceptions.ClientError as ex:
raise deploy_exceptions.DeployFailedError(stack_name=stack_name, msg=str(ex))
Expand Down