You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BUG | aws sso logout and configure sso crash with a traceback on missing token or project_long #350
Two crashes in leverage aws, found while adding CLI tests for it (#346, H6/H7). Both show a Python traceback instead of a clear message.
1. leverage aws sso logout without a cached token
If there is no ~/.aws/<project>/sso/cache/token (the user never logged in, or the cache was cleared), logout fails with FileNotFoundError: get_sso_access_token(paths.sso_token_file) reads the file unconditionally (leverage/modules/aws.py, logout).
To decide: should logout with no token
(a) still wipe the local cache and credentials and report "not logged in", or
(b) fail with a clear message?
(a) looks friendlier: logout should be idempotent.
2. leverage aws configure sso without project_long
configure_sso_profiles names each profile with acc_name.replace(paths.project_long + "-", ""). When project_long is missing from config/common.tfvars (and there is no PROJECT_LONG in build.env), paths.project_long is False, and this raises TypeError: unsupported operand type(s) for +: 'bool' and 'str'. By then the login has already happened, so the profiles are left half configured.
To decide: should a missing project_long
(a) be validated up front, next to the other SSO settings, with a clear error, or
(b) fall back to the full account name?
Notes
The CLI tests in tests/test_modules/test_aws.py (fixtures stubs and fake_aws_cli) make a regression test for either fix a few lines long.
Two related bugs are fixed in the PR that adds those tests: sso login without a configured profile, and configure sso with an account outside the organization and no OUs.
Activity