Nike-Inc / gimme-aws-creds

A CLI that utilizes Okta IdP via SAML to acquire temporary AWS credentials
Apache License 2.0
914 stars 262 forks source link

gimme-aws-creds fails with StopIteration exception #359

Open elcapitan-abdul opened 1 year ago

elcapitan-abdul commented 1 year ago

Expected Behavior

  1. execute gimme-aws-creds
  2. Using password from keyring for abcd@blah.com
  3. Pick a factor: [0] Okta Verify App: SmartPhone_Android: SM-S123U4 [1] token:software:totp( OKTA ) : abcd@blah.com
  4. Selection: 0 Okta Verify push sent...
  5. List of AWS Accounts to select from.

Current Behavior

when i execute gimme-aws-creds it crashes with StopIteration exception when trying to login to aws from CLI.

`Traceback (most recent call last): File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 787, in iter_selected_aws_credentials for role in self.aws_selected_roles: File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 670, in aws_selected_roles selected_roles = self._get_selected_roles(self.requested_roles, self.aws_roles) File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 660, in aws_roles self._cache['aws_roles'] = roles = self.resolver._enumerate_saml_roles( File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/aws.py", line 94, in _enumerate_saml_roles role = next(iter(table)) StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/homebrew/bin/gimme-aws-creds", line 17, in GimmeAWSCreds().run() File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 467, in run self._run() File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 816, in _run for data in self.iter_selected_aws_credentials(): RuntimeError: generator raised StopIteration`

Steps to Reproduce (for bugs)

  1. brew install gimme-aws-creds

  2. run gimme-aws-creds --action-configuration. >> .okta_aws_login_config file [DEFAULT] okta_org_url = https://some-org.okta.com okta_auth_server = client_id = gimme_creds_server = appurl aws_appname = aws_rolename = write_aws_creds = True cred_profile = default okta_username = user@example.com app_url = https://some-org.okta.com/home/amazon_aws_sso/... resolve_aws_alias = True preferred_mfa_type = token:software:totp remember_device = aws_default_duration = 28800 device_token = output_format = json

  3. execute gimme-aws-creds

  4. Using password from keyring for abcd@blah.com

  5. Pick a factor: [0] Okta Verify App: SmartPhone_Android: SM-S123U4 [1] token:software:totp( OKTA ) : abcd@blah.com

  6. Selection: 0 Okta Verify push sent... to mobile phone

  7. accept on okta verify app on mobile phone

  8. `Traceback (most recent call last): File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 787, in iter_selected_aws_credentials for role in self.aws_selected_roles: File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 670, in aws_selected_roles selected_roles = self._get_selected_roles(self.requested_roles, self.aws_roles) File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 660, in aws_roles self._cache['aws_roles'] = roles = self.resolver._enumerate_saml_roles( File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/aws.py", line 94, in _enumerate_saml_roles role = next(iter(table)) StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/opt/homebrew/bin/gimme-aws-creds", line 17, in GimmeAWSCreds().run() File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 467, in run self._run() File "/opt/homebrew/Cellar/gimme-aws-creds/2.4.4/libexec/lib/python3.10/site-packages/gimme_aws_creds/main.py", line 816, in _run for data in self.iter_selected_aws_credentials(): RuntimeError: generator raised StopIteration`

Your Environment

KamilBlaz commented 1 month ago

Any news here?

elcapitan-abdul commented 1 month ago

nope no response

epierce commented 1 month ago

Is this still an issue with the latest version? v2.4.4 was replaced 18 months ago