Skip to content

Commit

Permalink
Skip cleanup when not configured with a valid client (#488)
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed Dec 16, 2023
1 parent 3600669 commit 7309274
Showing 1 changed file with 8 additions and 0 deletions.
Expand Up @@ -329,6 +329,14 @@ public void cleanLeakedResources(
try {
final List<String> validVMs = getValidVMs();
final AzureResourceManager azureClient = cloud.getAzureClient();

if (azureClient == null) {
LOGGER.log(getNormalLoggingLevel(),
"cleanLeakedResources: Skipping cleanup as cloud is not configured with a "
+ "valid credential");
return;

Check warning on line 337 in src/main/java/com/microsoft/azure/vmagent/AzureVMAgentCleanUpTask.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 333-337 are not covered by tests
}

final AzureVMManagementServiceDelegate serviceDelegate = cloud.getServiceDelegate();
// can't use listByTag because for some reason that method strips all the tags from the outputted resources
// (https://github.com/Azure/azure-sdk-for-java/issues/1436)
Expand Down

0 comments on commit 7309274

Please sign in to comment.