Skip to content

Commit

Permalink
fix: a->b->c with boto3 parameters caused a cyclic dependency (#662)
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnfaherty committed Jun 19, 2023
2 parents 830c39a + 2d9fe49 commit ce5aabd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[tool.poetry]
name = "aws-service-catalog-puppet"
version = "0.231.0"
version = "0.231.1"
description = "Making it easier to deploy ServiceCatalog products"
classifiers = ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Natural Language :: English"]
homepage = "https://service-catalog-tools-workshop.com/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ def generate(puppet_account_id, manifest, output_file_path):
# Third pass - setting dependencies between parameters and outputs
#
for task_reference, task in all_tasks.items():
# wire up dependencies for SSM parameters to outputs
ssm_parameters = task.get("ssm_parameters_tasks_references", {}).items()
dependencies_to_add = []
for parameter_name, parameter_task_reference in ssm_parameters:
Expand All @@ -289,6 +290,7 @@ def generate(puppet_account_id, manifest, output_file_path):
].append(output_task_reference)
task["dependencies_by_reference"].extend(dependencies_to_add)

# wire up dependencies for boto3 parameters
boto3_parameters = task.get("boto3_parameters_tasks_references", {}).items()
dependencies_to_add = []
for parameter_name, parameter_task_reference in boto3_parameters:
Expand All @@ -309,6 +311,18 @@ def generate(puppet_account_id, manifest, output_file_path):
if task_reference in parameter_task["dependencies_by_reference"]:
parameter_task["dependencies_by_reference"].remove(task_reference)

#
# Fourth pass - removing cyclic dependencies caused by a->b->c when using boto3 parameters
#
for task_reference, task in all_tasks.items():
# remove dependencies on self
boto3_parameters = task.get("boto3_parameters_tasks_references", {}).items()
dependencies_to_add = []
for parameter_name, parameter_task_reference in boto3_parameters:
parameter_task = all_tasks.get(parameter_task_reference)
if task_reference in parameter_task.get("dependencies_by_reference"):
parameter_task["dependencies_by_reference"].remove(task_reference)

reference = dict(all_tasks=all_tasks,)
workflow_utils.ensure_no_cyclic_dependencies("complete task reference", all_tasks)
open(output_file_path, "w").write(serialisation_utils.dump_as_json(reference))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@

setup_kwargs = {
'name': 'aws-service-catalog-puppet',
'version': '0.231.0',
'version': '0.231.1',
'description': 'Making it easier to deploy ServiceCatalog products',
'long_description': '# aws-service-catalog-puppet\n\n![logo](./docs/logo.png) \n\n## Badges\n\n[![codecov](https://codecov.io/gh/awslabs/aws-service-catalog-puppet/branch/master/graph/badge.svg?token=e8M7mdsmy0)](https://codecov.io/gh/awslabs/aws-service-catalog-puppet)\n\n\n## What is it?\nThis is a python3 framework that makes it easier to share multi region AWS Service Catalog portfolios and makes it \npossible to provision products into accounts declaratively using a metadata based rules engine.\n\nWith this framework you define your accounts in a YAML file. You give each account a set of tags, a default region and \na set of enabled regions.\n\nOnce you have done this you can define portfolios should be shared with each set of accounts using the tags and you \ncan specify which regions the shares occur in.\n\nIn addition to this, you can also define products that should be provisioned into accounts using the same tag based \napproach. The framework will assume role into the target account and provision the product on your behalf.\n\n\n## Getting started\n\nYou can read the [installation how to](https://service-catalog-tools-workshop.com/30-how-tos/10-installation/30-service-catalog-puppet.html)\nor you can read through the [every day use](https://service-catalog-tools-workshop.com/30-how-tos/50-every-day-use.html)\nguides.\n\nYou can read the [documentation](https://aws-service-catalog-puppet.readthedocs.io/en/latest/) to understand the inner \nworkings. \n\n\n## Going further\n\nThe framework is one of a pair. The other is [aws-service-catalog-factory](https://github.com/awslabs/aws-service-catalog-factory).\nWith Service Catalog Factory you can create pipelines that deploy multi region portfolios very easily. \n\n## License\n\nThis library is licensed under the Apache 2.0 License. \n \n',
'author': 'Eamonn Faherty',
Expand Down

0 comments on commit ce5aabd

Please sign in to comment.