From 86f8759f940442070f22769ee5393054593aad3a Mon Sep 17 00:00:00 2001 From: Henning Jacobs Date: Wed, 4 Jan 2017 17:10:51 +0100 Subject: [PATCH] only mai create-all if saml_user_pattern is defined --- stups_cli/config.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/stups_cli/config.py b/stups_cli/config.py index ee1dc70..cc5a866 100644 --- a/stups_cli/config.py +++ b/stups_cli/config.py @@ -126,13 +126,14 @@ def configure(preselected_domain=None): with Action('Writing config for Zalando AWS CLI..'): store_config(autoconfigs['zalando-aws-cli'], 'zalando-aws-cli') - info('Now running "mai create-all" to configure your AWS profile(s)..') user_pattern = autoconfigs.get('mai', {}).get('saml_user_pattern') - identity_provider_url = autoconfigs.get('mai', {}).get('saml_identity_provider_url') - info('Please use the following pattern for your SAML username: {}'.format(user_pattern)) - returncode = subprocess.call(['mai', 'create-all', '--url', identity_provider_url]) - if returncode == 0: - info('You can now use "mai login .." to get temporary AWS credentials for your AWS account(s).') + if user_pattern: + info('Now running "mai create-all" to configure your AWS profile(s)..') + identity_provider_url = autoconfigs.get('mai', {}).get('saml_identity_provider_url') + info('Please use the following pattern for your SAML username: {}'.format(user_pattern)) + returncode = subprocess.call(['mai', 'create-all', '--url', identity_provider_url]) + if returncode == 0: + info('You can now use "mai login .." to get temporary AWS credentials for your AWS account(s).') if errors: info('Automatic configuration failed. Please check the entered STUPS domain.')