Skip to content

Commit

Permalink
Merge pull request #160 from asmorodskyi/fix_azure_imagedeletion
Browse files Browse the repository at this point in the history
Fix regression caused by upgrade of Azure API libs
  • Loading branch information
asmorodskyi authored Aug 7, 2022
2 parents 5dd602b + e6143d5 commit 4710773
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ocw/lib/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def cleanup_images_from_rg(self, keep_images):
if self.dry_run:
self.log_info("Deletion of image {} skipped due to dry run mode", item.name)
else:
self.compute_mgmt_client().images.delete(self.__resource_group, item.name)
self.compute_mgmt_client().images.begin_delete(self.__resource_group, item.name)

def cleanup_disks_from_rg(self, keep_images):
for item in self.list_disks_by_resource_group(self.__resource_group):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def mock_compute_mgmt_client(self):
def compute_mgmt_client():
pass
compute_mgmt_client.images = lambda: None
compute_mgmt_client.images.delete = lambda rg, name: deleted_images.append(name)
compute_mgmt_client.images.begin_delete = lambda rg, name: deleted_images.append(name)
return compute_mgmt_client

monkeypatch.setattr(Azure, 'resource_mgmt_client', mock_res_mgmt_client)
Expand Down

0 comments on commit 4710773

Please sign in to comment.