Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing default profile causes assume to fail #4

Open
zaro0508 opened this issue Jan 16, 2021 · 0 comments
Open

missing default profile causes assume to fail #4

zaro0508 opened this issue Jan 16, 2021 · 0 comments

Comments

@zaro0508
Copy link

assume fails if you don't have a default profile in ~/.aws/credentials file. Even worse than that assume will wipe out the contents of the credentials file in this scenario.

steps to repro:

  1. setup ~/.aws/credentials and ~/.aws/config files. Make sure [default] section is NOT in the credentials file.
  2. run assume add command.
    Note: fails with Error no section default and now the credentials file is empty.
➜  python -V
Python 3.7.9

➜  assume --version
0.4.0

➜  assume add myrole --profile testitorgmgnt-servicerole --role-arn arn:aws:iam::XXXXXXXXX:role/MyAccountAccessRole
Added role 'myrole' to the configuration. You can now assume this role with:

assume switch myrole

➜  assume list
myrole:
  profile: testitorgmgnt-servicerole
  role_arn: arn:aws:iam::XXXXXXXXX:role/MyAccountAccessRole

➜  assume switch myrole
Traceback (most recent call last):
  File "/Users/zaro0508/.virtualenvs/py37-default/bin/assume", line 8, in <module>
    sys.exit(main())
  File "/Users/zaro0508/.virtualenvs/py37-default/lib/python3.7/site-packages/aws_assume_role_helper/__main__.py", line 23, in main
    print(commands.switch(arguments.name))
  File "/Users/zaro0508/.virtualenvs/py37-default/lib/python3.7/site-packages/aws_assume_role_helper/commands.py", line 91, in switch
    for key in config_credentials.options('default'):
  File "/usr/local/var/pyenv/versions/3.7.9/lib/python3.7/configparser.py", line 674, in options
    raise NoSectionError(section) from None
configparser.NoSectionError: No section: 'default'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant