module_utils/redfish_utils.py: add ForceRestart option (#61104)

The library does not allow you to force a restart via redfish, (unless GracefulRestart
triggered by PowerReboot-command is not supported).
Therefore, I added the option `PowerForceRestart` to be able to force a reboot of an
unresponsive host.
This commit is contained in:
digi 2019-08-26 16:13:09 +02:00 committed by Gonéri Le Bouder
parent 5941e4c843
commit 7f06db8211
2 changed files with 3 additions and 1 deletions

View file

@ -647,6 +647,8 @@ class RedfishUtils(object):
payload = {'ResetType': 'On'} payload = {'ResetType': 'On'}
elif command == "PowerForceOff": elif command == "PowerForceOff":
payload = {'ResetType': 'ForceOff'} payload = {'ResetType': 'ForceOff'}
elif command == "PowerForceRestart":
payload = {'ResetType': "ForceRestart"}
elif command == "PowerGracefulRestart": elif command == "PowerGracefulRestart":
payload = {'ResetType': 'GracefulRestart'} payload = {'ResetType': 'GracefulRestart'}
elif command == "PowerGracefulShutdown": elif command == "PowerGracefulShutdown":

View file

@ -202,7 +202,7 @@ from ansible.module_utils._text import to_native
# More will be added as module features are expanded # More will be added as module features are expanded
CATEGORY_COMMANDS_ALL = { CATEGORY_COMMANDS_ALL = {
"Systems": ["PowerOn", "PowerForceOff", "PowerGracefulRestart", "Systems": ["PowerOn", "PowerForceOff", "PowerForceRestart", "PowerGracefulRestart",
"PowerGracefulShutdown", "PowerReboot", "SetOneTimeBoot"], "PowerGracefulShutdown", "PowerReboot", "SetOneTimeBoot"],
"Chassis": ["IndicatorLedOn", "IndicatorLedOff", "IndicatorLedBlink"], "Chassis": ["IndicatorLedOn", "IndicatorLedOff", "IndicatorLedBlink"],
"Accounts": ["AddUser", "EnableUser", "DeleteUser", "DisableUser", "Accounts": ["AddUser", "EnableUser", "DeleteUser", "DisableUser",