From cfc1ee26a9e2d30a6e243f058847b95c7f315c1e Mon Sep 17 00:00:00 2001 From: jordan-evans <42211944+jordan-evans@users.noreply.github.com> Date: Tue, 23 Nov 2021 09:33:24 +0000 Subject: [PATCH] Update aws.py --- servicecatalog_puppet/aws.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/servicecatalog_puppet/aws.py b/servicecatalog_puppet/aws.py index be255b3bb..4eee5ff37 100644 --- a/servicecatalog_puppet/aws.py +++ b/servicecatalog_puppet/aws.py @@ -559,13 +559,6 @@ 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" @@ -573,6 +566,13 @@ def get_portfolio_for(servicecatalog, portfolio_name): 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