mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
Merge pull request #26546 from nmadhok/vmware-key-error-patch-2015.5
Do not raise KeyError when calling avail_images if VM/template is in disconnected state
This commit is contained in:
commit
d721b7b2be
@ -1669,12 +1669,12 @@ def avail_images(call=None):
|
||||
vm_list = _get_mors_with_properties(vim.VirtualMachine, vm_properties)
|
||||
|
||||
for vm in vm_list:
|
||||
if vm["config.template"]:
|
||||
if "config.template" in vm and vm["config.template"]:
|
||||
templates[vm["name"]] = {
|
||||
'name': vm["name"],
|
||||
'guest_fullname': vm["config.guestFullName"],
|
||||
'cpus': vm["config.hardware.numCPU"],
|
||||
'ram': vm["config.hardware.memoryMB"]
|
||||
'guest_fullname': vm["config.guestFullName"] if "config.guestFullName" in vm else "N/A",
|
||||
'cpus': vm["config.hardware.numCPU"] if "config.hardware.numCPU" in vm else "N/A",
|
||||
'ram': vm["config.hardware.memoryMB"] if "config.hardware.memoryMB" in vm else "N/A"
|
||||
}
|
||||
|
||||
return templates
|
||||
|
Loading…
Reference in New Issue
Block a user