Commit b99477f9 by Szabolcs Gelencser

Catch UNKOWN state exceptions of VMs

parent 0fb681e6
...@@ -157,14 +157,17 @@ class Client: ...@@ -157,14 +157,17 @@ class Client:
group_name, vm_name.name, expand="instanceView" group_name, vm_name.name, expand="instanceView"
) )
# get vm power state try:
vm_power_state = ( # get vm power state
status for status in vm.instance_view.statuses vm_power_state = (
if status.code.startswith("PowerState") status for status in vm.instance_view.statuses
).next().code if status.code.startswith("PowerState")
).next().code
if(vm_power_state == "PowerState/running"):
running_virtual_machines.append(vm) if(vm_power_state == "PowerState/running"):
running_virtual_machines.append(vm)
except:
pass
return running_virtual_machines return running_virtual_machines
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment