seveas / python-hpilo

Accessing the HP iLO XML interface from python

Home Page:https://seveas.github.io/python-hpilo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

try - except with call_delayed() does not clean up request elements

conrad784 opened this issue · comments

I want to use the delayed call function in a try - except block
like this:

device.get_host_power_status()
device.get_persistent_boot()
first = device.call_delayed()
print(first)

print("\nNOW FAILING\n")
try:
    device.get_host_power_status()
    device.get_pending_boot_mode()
    second = device.call_delayed()
    print(second)
except hpilo.IloError:
    print("[ERROR] request failed")

print("\nNOW TRY THE FIRST ONE AGAIN\n")
device.get_host_power_status()
device.get_persistent_boot()
third = device.call_delayed()
print(third)

The third call will fail too, because _parse_message() will raise the exception and does not clean up self._elements and self._processors.

Thanks for reporting! This is now fixed in 87e94e4