_call_method should raise exception instead of returning None
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
oslo.vmware |
Opinion
|
Undecided
|
xhzhf |
Bug Description
classic scenario:
def power_on_
"""Power on the specified instance."""
if vm_ref is None:
vm_ref = get_vm_ref(session, instance)
LOG.
try:
except vexc.InvalidPow
if get_vm_ref return None, then PowerOnVM_Task execute with vm_ref None。 After that, _wait_for_task throw exception AttributeError: 'NoneType' object has no attribute 'state'。 It is hard to resolve problem according to the hint。
solution:
we modify __getattr__() in the oslo.vmware.
if not managed_object: return ====> raise ValueError(
Changed in oslo.vmware: | |
assignee: | nobody → xhzhf (guoyongxhzhf) |
status: | New → Confirmed |
Hi,
The get_vm_ref should throw an exception and not return None.
Can you please indicate how I can reproduce this.
Thanks
Gary