Skip to content

Commit

Permalink
fixing bootstrap accounts in ou command (issue #555) (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
eamonnfaherty committed Sep 2, 2022
1 parent c66fe5e commit b80986f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 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.187.0"
version = "0.188.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
18 changes: 18 additions & 0 deletions servicecatalog_puppet/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def bootstrap_spokes_in_ou(
puppet_role_path,
tag,
):
setup_config()
spoke_management_commands.bootstrap_spokes_in_ou(
ou_path_or_id,
role_name,
Expand Down Expand Up @@ -679,6 +680,7 @@ def validate(f):

@cli.command()
def version():
setup_config()
version_commands.version()


Expand All @@ -689,51 +691,59 @@ def version():
@click.option("--format", type=click.Choice(["csv", "json"]), default="csv")
@click.option("--limit", type=click.INT, default=20)
def show_codebuilds(filter, format, limit):
setup_config()
show_codebuilds_commands.show_codebuilds(filter, limit, format)


@cli.command()
@click.argument("p", type=click.Path(exists=True))
def upload_config(p):
setup_config()
content = open(p, "r").read()
management_commands.upload_config(yaml.safe_load(content))


@cli.command()
@click.argument("org-iam-role-arn")
def set_org_iam_role_arn(org_iam_role_arn):
setup_config()
orgs_commands.set_org_iam_role_arn(org_iam_role_arn)


@cli.command()
@click.argument("org-iam-role-arn")
def set_org_scp_role_arn(org_iam_role_arn):
setup_config()
orgs_commands.set_org_scp_role_arn(org_iam_role_arn)


@cli.command()
@click.argument("puppet_account_id")
@click.option("--tag", multiple=True, callback=parse_tags, default=[])
def bootstrap_org_master(puppet_account_id, tag):
setup_config()
orgs_commands.bootstrap_org_master(puppet_account_id, tag)


@cli.command()
@click.argument("puppet_account_id")
@click.option("--tag", multiple=True, callback=parse_tags, default=[])
def bootstrap_scp_master(puppet_account_id, tag):
setup_config()
orgs_commands.bootstrap_scp_master(puppet_account_id, tag)


@cli.command()
@click.argument("what", default="puppet")
@click.option("--tail/--no-tail", default=False)
def run(what, tail):
setup_config()
misc_commands.run(what, tail)


@cli.command()
def list_resources():
setup_config()
management_commands.list_resources()


Expand All @@ -742,30 +752,35 @@ def list_resources():
@click.argument("name")
@click.argument("portfolio_name")
def import_product_set(f, name, portfolio_name):
setup_config()
manifest_commands.import_product_set(f, name, portfolio_name)


@cli.command()
@click.argument("account_or_ou_file_path", type=click.File())
def add_to_accounts(account_or_ou_file_path):
setup_config()
manifest_commands.add_to_accounts(yaml.safe_load(account_or_ou_file_path))


@cli.command()
@click.argument("account_id_or_ou_id_or_ou_path")
def remove_from_accounts(account_id_or_ou_id_or_ou_path):
setup_config()
manifest_commands.remove_from_accounts(account_id_or_ou_id_or_ou_path)


@cli.command()
@click.argument("launch_file_path", type=click.File())
def add_to_launches(launch_name, launch_file_path):
setup_config()
manifest_commands.add_to_launches(launch_name, yaml.safe_load(launch_file_path))


@cli.command()
@click.argument("launch_name")
def remove_from_launches(launch_name):
setup_config()
manifest_commands.remove_from_launches(launch_name)


Expand Down Expand Up @@ -801,6 +816,7 @@ def set_named_config_value(name, value):
@click.argument("execution_id")
@click.option("--puppet-account-id", default=None)
def export_puppet_pipeline_logs(execution_id, puppet_account_id):
setup_config(puppet_account_id=puppet_account_id)
if puppet_account_id is None:
puppet_account_id = config.get_puppet_account_id()
management_commands.export_puppet_pipeline_logs(execution_id, puppet_account_id)
Expand All @@ -809,6 +825,7 @@ def export_puppet_pipeline_logs(execution_id, puppet_account_id):
@cli.command()
@click.option("--puppet-account-id", default=None)
def uninstall(puppet_account_id):
setup_config(puppet_account_id=puppet_account_id)
if puppet_account_id is None:
puppet_account_id = config.get_puppet_account_id()
misc_commands.uninstall(puppet_account_id)
Expand All @@ -817,6 +834,7 @@ def uninstall(puppet_account_id):
@cli.command()
@click.option("--puppet-account-id", default=None)
def release_spoke(puppet_account_id):
setup_config(puppet_account_id=puppet_account_id)
if puppet_account_id is None:
puppet_account_id = config.get_puppet_account_id()
spoke_management_commands.release_spoke(puppet_account_id)
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
'servicecatalog_puppet.workflow.dependencies',
'servicecatalog_puppet.workflow.general',
'servicecatalog_puppet.workflow.generate',
'servicecatalog_puppet.workflow.generic',
'servicecatalog_puppet.workflow.lambda_invocations',
'servicecatalog_puppet.workflow.launch',
'servicecatalog_puppet.workflow.manifest',
Expand Down Expand Up @@ -62,7 +61,7 @@

setup_kwargs = {
'name': 'aws-service-catalog-puppet',
'version': '0.187.0',
'version': '0.188.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 b80986f

Please sign in to comment.