From b8ceb224f9f50ba4a333d5731f1685630141a1fa Mon Sep 17 00:00:00 2001 From: Jay Carman Date: Mon, 31 Oct 2016 13:33:38 -0500 Subject: [PATCH] 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 --- pyghmi/ipmi/command.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyghmi/ipmi/command.py b/pyghmi/ipmi/command.py index f1f10f71..0bbb09af 100644 --- a/pyghmi/ipmi/command.py +++ b/pyghmi/ipmi/command.py @@ -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: