Skip to content

Commit

Permalink
BUGFIX: Fix issue when no profile specified.
Browse files Browse the repository at this point in the history
When no profile was specified, the code would take "None" as the
default, instead of "sts", which caused issues as None is not a string.

See #38 (comment)
  • Loading branch information
Mark Ide committed Jan 16, 2018
1 parent 6226626 commit 2a53e49
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions aws_google_auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,24 @@ def main():
def cli(cli_args):
exit_if_unsupported_python()

# Shortening Convenience functions
coalesce = util.Util.coalesce

args = parse_args(args=cli_args)

# Create a blank configuration object (has the defaults pre-filled)
config = configuration.Configuration()

# Have the configuration update itself via the ~/.aws/config on disk.
config.read(args.profile)
# Profile (Option priority = ARGS, ENV_VAR, DEFAULT)
config.profile = coalesce(
args.profile,
os.getenv('AWS_PROFILE'),
config.profile)

# Shortening Convenience functions
coalesce = util.Util.coalesce
# Now that we've established the profile, we can read the configuration and
# fill in all the other variables.
config.read(config.profile)

# Ask Role (Option priority = ARGS, ENV_VAR, DEFAULT)
config.ask_role = coalesce(
Expand All @@ -86,12 +94,6 @@ def cli(cli_args):
os.getenv('GOOGLE_IDP_ID'),
config.idp_id)

# Profile (Option priority = ARGS, ENV_VAR, DEFAULT)
config.profile = coalesce(
args.profile,
os.getenv('AWS_PROFILE'),
config.profile)

# Region (Option priority = ARGS, ENV_VAR, DEFAULT)
config.region = coalesce(
args.region,
Expand Down

0 comments on commit 2a53e49

Please sign in to comment.