From e49cd49f9e2daba11e0f1cd0150e8e24ff3ff911 Mon Sep 17 00:00:00 2001 From: alex-numo Date: Tue, 29 Mar 2022 10:22:59 -0400 Subject: [PATCH] fix(get-roles): support accounts with no alias --- aws_okta_processor/commands/getroles.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aws_okta_processor/commands/getroles.py b/aws_okta_processor/commands/getroles.py index 784273d..26384e3 100644 --- a/aws_okta_processor/commands/getroles.py +++ b/aws_okta_processor/commands/getroles.py @@ -81,9 +81,11 @@ def get_accounts_and_roles(self): accounts = app_and_role["Accounts"] for name_raw in accounts: - account_parts = re.match(r"(Account:) ([a-zA-Z0-9-_]+) \(([0-9]+)\)", name_raw) + account_parts = re.match( + r"(Account:) ([a-zA-Z0-9-_]+)(?: \(([0-9]+)\))?", name_raw + ) account = account_parts[2] - account_id = account_parts[3] + account_id = account_parts[3] or account_parts[2] roles = accounts[name_raw] result_roles = [] result_account = {