Skip to content

Commit

Permalink
Update aws.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jordan-evans authored Nov 22, 2021
1 parent 3e03a6f commit b2f636f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion servicecatalog_puppet/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def get_version_id_for(servicecatalog, product_id, version_name):
def get_portfolio_for(servicecatalog, portfolio_name):
result = None

response = servicecatalog.list_accepted_portfolio_shares(PortfolioShareType='AWS_ORGANIZATIONS')
response = servicecatalog.list_accepted_portfolio_shares()
assert response.get('NextPageToken') is None, "Pagination not supported"
for portfolio_detail in response.get('PortfolioDetails'):
if portfolio_detail.get('DisplayName') == portfolio_name:
Expand All @@ -566,6 +566,14 @@ def get_portfolio_for(servicecatalog, portfolio_name):
result = portfolio_detail
break

if result is None:
response = servicecatalog.list_accepted_portfolio_shares(PortfolioShareType='AWS_ORGANIZATIONS')
assert response.get('NextPageToken') is None, "Pagination not supported"
for portfolio_detail in response.get('PortfolioDetails'):
if portfolio_detail.get('DisplayName') == portfolio_name:
result = portfolio_detail
break

assert result is not None, "Could not find portfolio"
return result

Expand Down

0 comments on commit b2f636f

Please sign in to comment.