Raise IpmiException on error checking power state
To be consistent with the rest of the method this conditional should raise an exception instead of returning a dictionary with error. Also a :raises: note was added to the set_power docstring. Change-Id: I3d99d630019bb180c0ce3cd4cdb7652b32651352
This commit is contained in:
parent
4fcc75899e
commit
b8ceb224f9
|
@ -257,6 +257,7 @@ class Command(object):
|
|||
requested state change for 300 seconds.
|
||||
If a non-zero number, adjust the wait time to the
|
||||
requested number of seconds
|
||||
:raises: IpmiException on an error
|
||||
:returns: dict -- A dict describing the response retrieved
|
||||
"""
|
||||
if powerstate not in power_states:
|
||||
|
@ -289,7 +290,7 @@ class Command(object):
|
|||
while currpowerstate != waitpowerstate and waitattempts > 0:
|
||||
response = self.raw_command(netfn=0, command=1, delay_xmit=1)
|
||||
if 'error' in response:
|
||||
return response
|
||||
raise exc.IpmiException(response['error'])
|
||||
currpowerstate = 'on' if (response['data'][0] & 1) else 'off'
|
||||
waitattempts -= 1
|
||||
if currpowerstate != waitpowerstate:
|
||||
|
|
Loading…
Reference in New Issue