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 23, 2021
1 parent b2f636f commit cfc1ee2
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions servicecatalog_puppet/aws.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,20 +559,20 @@ def get_portfolio_for(servicecatalog, portfolio_name):
result = portfolio_detail
break

if result is None:
response = servicecatalog.list_portfolios_single_page()
for portfolio_detail in response.get('PortfolioDetails', []):
if portfolio_detail.get('DisplayName') == 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

if result is None:
response = servicecatalog.list_portfolios_single_page()
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 cfc1ee2

Please sign in to comment.