mozilla-iam/mozilla-aws-cli

IndexError when running maws

jschwartzentruber opened this issue · 2 comments

When running maws for the first time, I'm getting this:

$ eval $(maws)
2020-06-08:10:39:21 ERROR    [app.py:1891] Exception on /api/roles [GET]
Traceback (most recent call last):
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/mozilla_aws_cli/listener.py", line 92, in get_roles
    alias = login.role_map.get(
IndexError: list index out of range
2020-06-08:10:39:32 ERROR    [listener.py:131] No response from web interface for 10 seconds, shutting down.
$

The login page does load, but is stuck at "Federation in progress..."

If I try to specify the role directly, I get a different traceback:

$ eval $(maws -r "arn:aws:iam::xxxxxxxxxxxxx:role/MAWS-Admin")
Unable to contact AWS : Traceback (most recent call last):
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/mozilla_aws_cli/login.py", line 360, in exchange_token_for_credentials
    self.print_output()
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/mozilla_aws_cli/login.py", line 418, in print_output
    self.display_name = role_arn_to_display_name(self.role_arn, self.role_map)
  File "/home/truber/.virtualenvs/maws/lib/python3.8/site-packages/mozilla_aws_cli/utils.py", line 44, in role_arn_to_display_name
    account_id = role_map.get("aliases", {}).get(account_id, [account_id])[0]
IndexError: list index out of range
$

I'm able to login with this role via aws.sso.mozilla.com without issue.

@jschwartzentruber This fix is deployed in production, try it again.

@gene1wood Works now, thanks!