awslabs / aws-service-catalog-products

This repository contains a number of CloudFormation templates which can be used independently or as Products with AWS Service Catalog including the Open Source Tools AWS Service Catalog Factory and AWS Service Catalog Puppet. The templates include a number of the foundational AWS Services you may choose to manage Account Compliance including AWS Config, AWS CloudTrail and GuardDuty
MIT No Attribution
162 stars 36 forks source link

instead of using Portfolios/Components, use Products and Portfolios separately #66

Open xmik opened 3 years ago

xmik commented 3 years ago

Reason for this PR

Without this change, creating the Service Catalog Products results in the following error in servicecatalog-factory-pipeline:

[Container] 2021/06/25 10:25:56 Entering phase BUILD
[Container] 2021/06/25 10:25:56 Running command servicecatalog-factory --info generate-via-luigi portfolios/
INFO MainThread Generating
INFO MainThread Loading portfolio: portfolios//scp.yaml
INFO MainThread Checking for external config
Traceback (most recent call last):
  File "/root/.pyenv/versions/3.7.10/bin/servicecatalog-factory", line 8, in <module>
    sys.exit(cli())
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/servicecatalog_factory/cli.py", line 38, in generate_via_luigi
    core.generate_via_luigi(p)
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/servicecatalog_factory/core.py", line 162, in generate_via_luigi
    portfolios = generate_portfolios(portfolios_file_path)
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/servicecatalog_factory/core.py", line 96, in generate_portfolios
    portfolio, portfolio_file_name, "Components
  File "/root/.pyenv/versions/3.7.10/lib/python3.7/site-packages/servicecatalog_factory/core.py", line 105, in check_for_external_definitions_for
    for component in portfolio.get(type, []):
AttributeError: 'str' object has no attribute 'get'
[Container] 2021/06/25 10:25:56 Command did not exit successfully servicecatalog-factory --info generate-via-luigi portfolios/ exit status 1
[Container] 2021/06/25 10:25:56 Phase complete: BUILD State: FAILED
[Container] 2021/06/25 10:25:56 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: servicecatalog-factory --info generate-via-luigi portfolios/. Reason: exit status 1
[Container] 2021/06/25 10:25:56 Entering phase POST_BUILD

Environment:

aws-service-catalog-factory==0.60.0

Description of changes

  1. The portfolio file, instead of starting it with:
    Schema: factory-2019-04-01
    Portfolios:
    Components:

    let's start with:

    Schema: factory-2019-04-01
    Products:

    and end with

    Portfolios:
  2. I also changed the BranchName: master for the 2 Service Catalog Products here to BranchName: v1 to align with the documentation

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.