diff --git a/ocw/lib/azure.py b/ocw/lib/azure.py index 455952c8..70d2a1df 100644 --- a/ocw/lib/azure.py +++ b/ocw/lib/azure.py @@ -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): diff --git a/tests/test_azure.py b/tests/test_azure.py index 5bdc9059..815d553e 100644 --- a/tests/test_azure.py +++ b/tests/test_azure.py @@ -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)