trek10inc / awsume

A utility for easily assuming AWS IAM roles from the command line.

Home Page:https://awsu.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error on awsume -a

aaronkelton opened this issue · comments

When I install awsume via pipx and pip, I get the following error when running awsume -a. Do you know if this is a Python3-specific issue? I am happy to provide any extra info to help diagnose. Thank you!

~ % awsume -a     
Traceback (most recent call last):
  File "/Users/aaronkelton/.local/bin/awsumepy", line 8, in <module>
    sys.exit(main())
  File "/Users/aaronkelton/.local/pipx/venvs/awsume/lib/python3.10/site-packages/awsume/awsumepy/main.py", line 29, in main
    run_awsume(sys.argv[1:])
  File "/Users/aaronkelton/.local/pipx/venvs/awsume/lib/python3.10/site-packages/awsume/awsumepy/main.py", line 17, in run_awsume
    awsume.run(argument_list)
  File "/Users/aaronkelton/.local/pipx/venvs/awsume/lib/python3.10/site-packages/awsume/awsumepy/app.py", line 263, in run
    credentials = self.get_credentials(args, profiles)
  File "/Users/aaronkelton/.local/pipx/venvs/awsume/lib/python3.10/site-packages/awsume/awsumepy/app.py", line 205, in get_credentials
    create_autoawsume_profile(self.config, args, profiles, credentials)
  File "/Users/aaronkelton/.local/pipx/venvs/awsume/lib/python3.10/site-packages/awsume/awsumepy/lib/autoawsume.py", line 18, in create_autoawsume_profile
    profile['expiration'] = role_session.get('Expiration').strftime('%Y-%m-%d %H:%M:%S')
AttributeError: 'NoneType' object has no attribute 'strftime'

Awsume version

~ % awsume -v
4.5.3

The auto-refresh tries to parse the expiration date so it knows when to refresh, however the user session, without an assumed role, by default in the aws cli has no expiration, so auto has nothing to parse and thus refresh. Or at least that was the case for me. I added a default expiration or a year in the future in my fork and that fixed the issue for me
master...jtzero:awsume:master Not sure if that's the correct solution