remove non-standard CreateBiosConfigJob command (#48740)

pull/49630/head
Bill Dodd 6 years ago committed by Brian Coca
parent 4f416597b8
commit 303c3494e6

@ -379,7 +379,13 @@ class RedfishUtils(object):
return response
result['ret'] = True
data = response['data']
action_uri = data[key]["#ComputerSystem.Reset"]["target"]
power_state = data["PowerState"]
reset_action = data[key]["#ComputerSystem.Reset"]
action_uri = reset_action["target"]
allowable_vals = reset_action.get("ResetType@Redfish.AllowableValues", [])
restart_cmd = "GracefulRestart"
if "ForceRestart" in allowable_vals and "GracefulRestart" not in allowable_vals:
restart_cmd = "ForceRestart"
# Define payload accordingly
if command == "PowerOn":
@ -390,6 +396,11 @@ class RedfishUtils(object):
payload = {'ResetType': 'GracefulRestart'}
elif command == "PowerGracefulShutdown":
payload = {'ResetType': 'GracefulShutdown'}
elif command == "PowerReboot":
if power_state == "On":
payload = {'ResetType': restart_cmd}
else:
payload = {'ResetType': "On"}
else:
return {'ret': False, 'msg': 'Invalid Command'}
@ -742,42 +753,6 @@ class RedfishUtils(object):
return response
return {'ret': True, 'changed': True, 'msg': "Modified BIOS attribute"}
def create_bios_config_job(self):
result = {}
key = "Bios"
jobs = "Jobs"
# Search for 'key' entry and extract URI from it
response = self.get_request(self.root_uri + self.systems_uri)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
if key not in data:
return {'ret': False, 'msg': "Key %s not found" % key}
bios_uri = data[key]["@odata.id"]
# Extract proper URI
response = self.get_request(self.root_uri + bios_uri)
if response['ret'] is False:
return response
result['ret'] = True
data = response['data']
set_bios_attr_uri = data["@Redfish.Settings"]["SettingsObject"]["@odata.id"]
payload = {"TargetSettingsURI": set_bios_attr_uri}
response = self.post_request(self.root_uri + self.manager_uri + "/" + jobs, payload, HEADERS)
if response['ret'] is False:
return response
response_output = response['resp'].__dict__
job_id = response_output["headers"]["Location"]
job_id = re.search("JID_.+", job_id).group()
# Currently not passing job_id back to user but patch is coming
return {'ret': True, 'msg': "Config job %s created" % job_id}
def get_fan_inventory(self):
result = {}
fan_results = []

@ -146,8 +146,7 @@ from ansible.module_utils._text import to_native
# More will be added as module features are expanded
CATEGORY_COMMANDS_ALL = {
"Systems": ["PowerOn", "PowerForceOff", "PowerGracefulRestart",
"PowerGracefulShutdown", "SetOneTimeBoot",
"CreateBiosConfigJob"],
"PowerGracefulShutdown", "PowerReboot", "SetOneTimeBoot"],
"Accounts": ["AddUser", "EnableUser", "DeleteUser", "DisableUser",
"UpdateUserRole", "UpdateUserPassword"],
"Manager": ["GracefulRestart", "ClearLogs"],
@ -230,12 +229,6 @@ def main():
result = rf_utils.manage_system_power(command)
elif command == "SetOneTimeBoot":
result = rf_utils.set_one_time_boot_device(module.params['bootdevice'])
elif command == "CreateBiosConfigJob":
# execute only if we find a Managers resource
result = rf_utils._find_managers_resource(rf_uri)
if result['ret'] is False:
module.fail_json(msg=to_native(result['msg']))
result = rf_utils.create_bios_config_job()
elif category == "Manager":
MANAGER_COMMANDS = {

Loading…
Cancel
Save