diff --git a/.gitignore b/.gitignore index 39b5e0ea2..a3383022b 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,5 @@ env */archive.tar.gz tooling/bin tooling/image-sync/config.yml +**/venv +**/__pycache__ \ No newline at end of file diff --git a/tooling/azure-automation/resources-cleanup/requirements.txt b/tooling/azure-automation/resources-cleanup/requirements.txt index 54c2e3990..288fc1819 100644 --- a/tooling/azure-automation/resources-cleanup/requirements.txt +++ b/tooling/azure-automation/resources-cleanup/requirements.txt @@ -19,7 +19,7 @@ portalocker==2.8.2 pycparser==2.21 PyJWT==2.8.0 pytest==7.4.4 -requests==2.32.0 +requests==2.32.3 six==1.16.0 tomli==2.0.1 typing_extensions==4.9.0 diff --git a/tooling/azure-automation/resources-cleanup/src/resources_cleanup.py b/tooling/azure-automation/resources-cleanup/src/resources_cleanup.py index 5a7b00f45..7db6841a4 100644 --- a/tooling/azure-automation/resources-cleanup/src/resources_cleanup.py +++ b/tooling/azure-automation/resources-cleanup/src/resources_cleanup.py @@ -120,10 +120,11 @@ def process_resource_group(resource_group: ResourceGroup, resource_client: Resou result_poller = resource_client.resource_groups.begin_delete(resource_group_name) print(f"result_poller of resource group deletion: {result_poller}") except HttpResponseError as err: - target_error_code = "DenyAssignmentAuthorizationFailed" - if err.error.code == target_error_code: + if err.error.code == "DenyAssignmentAuthorizationFailed": print("skipping deletion of resource group due to deny assignment in the resource group") - else: + elif err.error.code == "ScopeLocked": + print("cannot perform delete operation, the resource group is locked") + else: raise err