2
0
mirror of https://opendev.org/x/pyghmi synced 2026-01-11 18:52:33 +00:00

Replace set_power manual call to grab_json_response

The manual call is more work and missing some common handling
like for the authentication token.

Change-Id: Ia9b3d8aec6a672a0fb2cf10cb4c81761892c9580
This commit is contained in:
Jarrod Johnson
2025-04-30 11:24:38 -04:00
parent 4826c58fb1
commit 3fada0442c

View File

@@ -522,10 +522,8 @@ class Command(object):
raise exc.InvalidParameterValue(
"Unknown power state %s requested" % powerstate)
powerstate = powerstates[powerstate]
result = self.wc.grab_json_response_with_status(
self._do_web_request(
self.powerurl, {'ResetType': powerstate})
if result[1] < 200 or result[1] >= 300:
raise exc.PyghmiException(result[0])
if wait and reqpowerstate in ('on', 'off', 'softoff', 'shutdown'):
if reqpowerstate in ('softoff', 'shutdown'):
reqpowerstate = 'off'