Skip to content

Commit

Permalink
fixing #573 (#574)
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnfaherty committed Oct 21, 2022
1 parent 73b739a commit 7f5ee01
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 6 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.195.1"
version = "0.196.0"
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
6 changes: 5 additions & 1 deletion servicecatalog_puppet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,9 @@ def setup_config(
] = global_sharing_mode_default
if on_complete_url:
os.environ[environmental_variables.ON_COMPLETE_URL] = on_complete_url
os.environ[
environmental_variables.SPOKE_EXECUTION_MODE_DEPLOY_ENV
] = remote_config.get_spoke_deploy_environment_compute_type(puppet_account_id_to_use, home_region)


@cli.command()
Expand Down Expand Up @@ -784,7 +787,8 @@ def set_regions(regions):
@click.argument("name")
@click.argument("value")
def set_config_value(name, value):
management_commands.set_config_value(name, value)
is_a_boolean = dict(spoke_deploy_environment_compute_type=False).get(name, True)
management_commands.set_config_value(name, value, is_a_boolean)


@cli.command()
Expand Down
7 changes: 5 additions & 2 deletions servicecatalog_puppet/commands/management.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def list_resources():
click.echo(f"n.b. AWS::StackName evaluates to {constants.BOOTSTRAP_STACK_NAME}")


def set_config_value(name, value):
def set_config_value(name, value, is_a_boolean=True):
with betterboto_client.ClientContextManager(
"ssm", region_name=constants.HOME_REGION
) as ssm:
Expand All @@ -102,7 +102,10 @@ def set_config_value(name, value):
if name == "regions":
config["regions"] = value if len(value) > 1 else value[0].split(",")
else:
config[name] = value.upper() == "TRUE"
if is_a_boolean:
config[name] = value.upper() == "TRUE"
else:
config[name] = value

upload_config(config)

Expand Down
1 change: 1 addition & 0 deletions servicecatalog_puppet/environmental_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@
IS_CACHING_ENABLED = "SCT_IS_CACHING_ENABLED"
GLOBAL_SHARING_MODE = "SCT_GLOBAL_SHARING_MODE"
ON_COMPLETE_URL = "SCT_ON_COMPLETE_URL"
SPOKE_EXECUTION_MODE_DEPLOY_ENV = "SCT_SPOKE_EXECUTION_MODE_DEPLOY_ENV"
11 changes: 11 additions & 0 deletions servicecatalog_puppet/remote_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,14 @@ def get_global_sharing_mode_default(puppet_account_id, default_region=None):
return get_config(puppet_account_id, default_region).get(
"global_sharing_mode_default", constants.SHARING_MODE_DEFAULT
)


def get_spoke_deploy_environment_compute_type(puppet_account_id, default_region):
logger.info(
"getting spoke_deploy_environment_compute_type, default_region: {}".format(
default_region
)
)
return get_config(puppet_account_id, default_region).get(
"spoke_deploy_environment_compute_type", constants.SPOKE_EXECUTION_MODE_DEPLOY_ENV_DEFAULT
)
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ Resources:
- servicecatalog-puppet set-config-value should_use_stacks_service_role ${SHOULD_USE_STACKS_SERVICE_ROLE}
- servicecatalog-puppet set-config-value should_delete_rollback_complete_stacks ${SHOULD_DELETE_ROLLBACK_COMPLETE_STACKS}
- servicecatalog-puppet set-config-value is_caching_enabled ${IS_CACHING_ENABLED}
- servicecatalog-puppet set-config-value spoke_deploy_environment_compute_type ${SPOKE_DEPLOY_ENVIRONMENT_COMPUTE_TYPE}
- servicecatalog-puppet bootstrap-spoke ${PUPPET_ACCOUNT_ID} --permission-boundary ${PUPPET_ROLE_PERMISSION_BOUNDARY} --puppet-role-name ${PUPPET_ROLE_NAME} --puppet-role-path ${PUPPET_ROLE_PATH}
build:
commands:
Expand Down
2 changes: 1 addition & 1 deletion servicecatalog_puppet/workflow/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def execution_mode(self):
@property
def spoke_execution_mode_deploy_env(self):
return os.environ.get(
"SPOKE_EXECUTION_MODE_DEPLOY_ENV",
environmental_variables.SPOKE_EXECUTION_MODE_DEPLOY_ENV,
constants.SPOKE_EXECUTION_MODE_DEPLOY_ENV_DEFAULT,
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

setup_kwargs = {
'name': 'aws-service-catalog-puppet',
'version': '0.195.1',
'version': '0.196.0',
'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 7f5ee01

Please sign in to comment.