mirror of
https://opendev.org/x/pyghmi
synced 2025-01-14 19:57:47 +00:00
Avoid telling a server to enter existing power state
Some redfish implementations do not handle such a request gracefully. Avoid sending the command if the command allegedly would have no effect. Change-Id: I21b3ce18bb37747b71a67cbd0268d227ade6aad9
This commit is contained in:
parent
2311bc9f0b
commit
929cd5b566
@ -496,6 +496,10 @@ class Command(object):
|
||||
if powerstate == 'boot':
|
||||
oldpowerstate = self.get_power()['powerstate']
|
||||
powerstate = 'on' if oldpowerstate == 'off' else 'reset'
|
||||
elif powerstate in ('on', 'off'):
|
||||
oldpowerstate = self.get_power()['powerstate']
|
||||
if oldpowerstate == powerstate:
|
||||
return {'powerstate': powerstate}
|
||||
reqpowerstate = powerstate
|
||||
if powerstate not in powerstates:
|
||||
raise exc.InvalidParameterValue(
|
||||
|
Loading…
x
Reference in New Issue
Block a user