@@ -350,6 +350,7 @@ def cleanup():
350350
351351 isALZorCT = config ["global-options" ]["alz-baseline" ] or config ["global-options" ]["alz-baseline" ]
352352
353+
353354 if isALZorCT :
354355 print ("This cleanup script is designed to retract all components deployed in the accelerator and is intended for development use. It isn't tested for cleanup with baseline configurations." )
355356 return
@@ -814,6 +815,8 @@ def cleanup_directory_sharing_load_config():
814815
815816 mad_account_name = config ["global-options" ]["central-operations-services" ]["account" ]
816817 mad_account = config ["mandatory-account-configs" ][mad_account_name ]["account-name" ]
818+ if "mad" not in config ["mandatory-account-configs" ][mad_account_name ]["deployments" ]:
819+ return "mad not configured"
817820 mad_dns_domain = config ["mandatory-account-configs" ][mad_account_name ]["deployments" ]["mad" ]["dns-domain" ]
818821
819822
@@ -859,14 +862,17 @@ def cleanup_route53_resolver_load_config():
859862 master_account_name = ""
860863 admin_role = ""
861864 master_region = ""
862-
865+
863866 with open ('config.json' ) as json_file :
864867 config = json .load (json_file )
865868
866869 admin_role = config ["global-options" ]["organization-admin-role" ]
867870 master_region = config ["global-options" ]["aws-org-master" ]["region" ]
868871
869872 central_account_name = config ["global-options" ]["central-operations-services" ]["account" ]
873+ if "mad" not in config ["mandatory-account-configs" ][central_account_name ]["deployments" ]:
874+ return "mad not configured"
875+
870876 central_resolver_rule_account = config ["mandatory-account-configs" ][central_account_name ]["deployments" ]["mad" ]["central-resolver-rule-account" ]
871877
872878 config_master_account_name = config ["global-options" ]["aws-org-master" ]["account" ]
@@ -934,4 +940,4 @@ def configure_args():
934940if __name__ == "__main__" :
935941 configure_args ()
936942 backup_config ()
937- cleanup ()
943+ cleanup ()
0 commit comments