diff --git a/changelogs/fragments/51898-remove-non-standard-redfish-manager-attrs-commands.yaml b/changelogs/fragments/51898-remove-non-standard-redfish-manager-attrs-commands.yaml new file mode 100644 index 0000000000..67683f9e1d --- /dev/null +++ b/changelogs/fragments/51898-remove-non-standard-redfish-manager-attrs-commands.yaml @@ -0,0 +1,3 @@ +--- +bugfixes: +- "deprecate {Get/Set}ManagerAttributes commands (https://github.com/ansible/ansible/issues/47590)" diff --git a/lib/ansible/module_utils/redfish_utils.py b/lib/ansible/module_utils/redfish_utils.py index 0049ff29d9..9233643b53 100644 --- a/lib/ansible/module_utils/redfish_utils.py +++ b/lib/ansible/module_utils/redfish_utils.py @@ -522,6 +522,8 @@ class RedfishUtils(object): response = self.get_request(self.root_uri + self.manager_uri + "/" + key) if response['ret'] is False: + if '404' in response.get('msg'): + response['msg'] = 'The GetManagerAttributes command is not supported on this Redfish service' return response result['ret'] = True data = response['data'] @@ -704,8 +706,10 @@ class RedfishUtils(object): payload = {"Attributes": json.loads(manager_attr)} response = self.patch_request(self.root_uri + self.manager_uri + "/" + attributes, payload, HEADERS) if response['ret'] is False: + if '404' in response.get('msg'): + response['msg'] = 'The SetManagerAttributes command is not supported on this Redfish service' return response - return {'ret': True} + return {'ret': True, 'changed': True, 'msg': "Modified Manager attribute"} def set_bios_attributes(self, attr): result = {} diff --git a/lib/ansible/modules/remote_management/redfish/redfish_config.py b/lib/ansible/modules/remote_management/redfish/redfish_config.py index 51aa8f18c6..16eae01671 100644 --- a/lib/ansible/modules/remote_management/redfish/redfish_config.py +++ b/lib/ansible/modules/remote_management/redfish/redfish_config.py @@ -223,6 +223,10 @@ def main(): for command in command_list: if command == "SetManagerAttributes": + module.deprecate(msg='The SetManagerAttributes command in ' + 'module redfish_config is deprecated. ' + 'Use an OEM Redfish module instead.', + version='2.8') result = rf_utils.set_manager_attributes(mgr_attributes) # Return data back or fail with proper message diff --git a/lib/ansible/modules/remote_management/redfish/redfish_facts.py b/lib/ansible/modules/remote_management/redfish/redfish_facts.py index ac89ac9e67..ce783ddd0a 100644 --- a/lib/ansible/modules/remote_management/redfish/redfish_facts.py +++ b/lib/ansible/modules/remote_management/redfish/redfish_facts.py @@ -255,6 +255,10 @@ def main(): for command in command_list: if command == "GetManagerAttributes": + module.deprecate(msg='The GetManagerAttributes command in ' + 'module redfish_facts is deprecated. ' + 'Use an OEM Redfish module instead.', + version='2.8') result["manager_attributes"] = rf_utils.get_manager_attributes() elif command == "GetLogs": result["log"] = rf_utils.get_logs()