mirror of https://github.com/apache/jclouds.git
Checks existence of node before getting SecurityGroups and Images
This commit is contained in:
parent
efb3dd53d0
commit
21cda804b8
|
@ -115,7 +115,7 @@ public class AzureComputeImageExtension implements ImageExtension {
|
|||
URI uri = api.getVirtualMachineApi(resourceGroupName)
|
||||
.capture(regionAndId.id(), cloneTemplate.getName(), CONTAINER_NAME);
|
||||
checkState(uri != null && imageAvailablePredicate.apply(uri),
|
||||
"Image %s was not created within the configured time limit", cloneTemplate.getName());
|
||||
"Image for node %s was not created within the configured time limit", cloneTemplate.getName());
|
||||
|
||||
List<ResourceDefinition> definitions = api.getJobApi().captureStatus(uri);
|
||||
checkState(definitions.size() == 1,
|
||||
|
@ -123,6 +123,7 @@ public class AzureComputeImageExtension implements ImageExtension {
|
|||
|
||||
Image image = resourceDefinitionToImage.create(cloneTemplate.getSourceNodeId(), cloneTemplate.getName())
|
||||
.apply(definitions.get(0));
|
||||
checkState(image != null, "Image for node %s was not created", cloneTemplate.getSourceNodeId());
|
||||
logger.debug(">> created %s", image);
|
||||
return image;
|
||||
}
|
||||
|
|
|
@ -123,6 +123,9 @@ public class AzureComputeSecurityGroupExtension implements SecurityGroupExtensio
|
|||
ResourceGroup resourceGroup = resourceGroupMap.getUnchecked(regionAndId.region());
|
||||
|
||||
VirtualMachine vm = api.getVirtualMachineApi(resourceGroup.name()).get(regionAndId.id());
|
||||
if (vm == null) {
|
||||
throw new IllegalArgumentException("Node " + regionAndId.id() + " was not found");
|
||||
}
|
||||
List<IdReference> networkInterfacesIdReferences = vm.properties().networkProfile().networkInterfaces();
|
||||
List<NetworkSecurityGroup> networkGroups = new ArrayList<NetworkSecurityGroup>();
|
||||
|
||||
|
|
|
@ -68,6 +68,9 @@ public class ResourceDefinitionToCustomImage implements Function<ResourceDefinit
|
|||
ResourceGroup resourceGroup = resourceGroupMap.getUnchecked(regionAndId.region());
|
||||
|
||||
VirtualMachine vm = api.getVirtualMachineApi(resourceGroup.name()).get(regionAndId.id());
|
||||
if (vm == null) {
|
||||
return null;
|
||||
}
|
||||
String storageAccountName = storageProfileToStorageAccountName.apply(vm.properties().storageProfile());
|
||||
|
||||
VMImage.Builder builder = VMImage.customImage().group(resourceGroup.name()).storage(storageAccountName)
|
||||
|
|
Loading…
Reference in New Issue