Skip to content

Commit

Permalink
handle opt-in region during master account enable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Cornick committed Oct 6, 2020
1 parent 5cf6b59 commit 6e6ba02
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/securityhub_enabler.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,12 @@ def enable_master(master_session, securityhub_regions, partition):
except Exception as e:
LOGGER.info(f"SecurityHub not currently Enabled on Master Account "
f"{master_account} in {region}. Enabling it.")
sh_master_client.enable_security_hub(
EnableDefaultStandards=False
)
try:
sh_master_client.enable_security_hub(
EnableDefaultStandards=False
)
except:
LOGGER.error(f"Failed to enable SecurityHub in {region} or {master_account}")
else:
LOGGER.info(f"SecurityHub already Enabled in Master Account "
f"{master_account} in {region}")
Expand Down

0 comments on commit 6e6ba02

Please sign in to comment.