Skip to content

Commit

Permalink
fix some potential null pointers in AzureNode
Browse files Browse the repository at this point in the history
for status (vm.powerstate)
and size (name etc)
  • Loading branch information
rcomanne authored Jun 12, 2019
1 parent 1e7bfe1 commit fec0b09
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/main/groovy/com/rundeck/plugins/azure/azure/AzureNode.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,19 @@ class AzureNode {
azureAttributes.vmId = vm.vmId()
azureAttributes.region = vm.region()?.name()
azureAttributes.resourceGroup = vm.resourceGroupName()
azureAttributes.status = vm.powerState()?.toString().replace("PowerState/","")
azureAttributes.status = vm.powerState()?.toString()?.replace("PowerState/","")

if(vm.plan()!=null){
azureAttributes."plan:name" = vm.plan().name()
azureAttributes."plan:product" = vm.plan().product()
azureAttributes."plan:publisher" = vm.plan().publisher()
}

azureAttributes."size:name" = size.name()
azureAttributes."size:numberOfCores" = size.numberOfCores()
azureAttributes."size:memoryInMB" = size.memoryInMB()
azureAttributes."size:maxDataDiskCount" = size.maxDataDiskCount()
azureAttributes."size:resourceDiskSizeInMB" = size.resourceDiskSizeInMB()
azureAttributes."size:name" = size?.name()
azureAttributes."size:numberOfCores" = size?.numberOfCores()
azureAttributes."size:memoryInMB" = size?.memoryInMB()
azureAttributes."size:maxDataDiskCount" = size?.maxDataDiskCount()
azureAttributes."size:resourceDiskSizeInMB" = size?.resourceDiskSizeInMB()

azureAttributes."image:type" = vm.storageProfile()?.imageReference()?.publisher()?.toString()
azureAttributes."image:offer" = vm.storageProfile()?.imageReference()?.offer()?.toString()
Expand Down Expand Up @@ -193,4 +193,4 @@ class AzureNode {

return map
}
}
}

0 comments on commit fec0b09

Please sign in to comment.