dell / iDRAC-Redfish-Scripting

Python and PowerShell scripting for Dell EMC PowerEdge iDRAC REST API with DMTF Redfish
GNU General Public License v2.0
600 stars 278 forks source link

BiosSetAttributeREDFISH.py gives error on some existing params as not existing #189

Closed OmarReygaert closed 2 years ago

OmarReygaert commented 2 years ago

error thrown when changing this values in one line: python Redfish\ Python/BiosSetAttributeREDFISH.py -ip X.X.X.X -u root -p XXX -an PxeDev1Interface,PxeDev2EnDis,PxeDev3EnDis,PxeDev4EnDis,SysProfile -av NIC.Integrated.1-1-1,disabled,disabled,disabled,PerfOptimized

gives:

but then, the command does changes the values for PxeDev2EnDis, PxeDev3EnDis and PxeDev4EnDis, but not the other remaining values, and gives then an error:

- FAIL, Command failed, errror code is 400 {'cookies': <<class 'requests.cookies.RequestsCookieJar'>[]>, '_content': '{"error":{"@Message.ExtendedInfo":[{"Message":"Unable to set the object properties because an incorrect object value is entered.","MessageArgs":["PxeDev2EnDis"],"MessageArgs@odata.count":1,"MessageId":"IDRAC.2.3.SYS409","RelatedProperties":["PxeDev2EnDis"],"RelatedProperties@odata.count":1,"Resolution":"Enter a valid object value and retry the operation. For information about recommended values, see the schema or the attribute registry based on the type of resource.","Severity":"Warning"},{"Message":"Unable to set the object properties because an incorrect object value is entered.","MessageArgs":["PxeDev3EnDis"],"MessageArgs@odata.count":1,"MessageId":"IDRAC.2.3.SYS409","RelatedProperties":["PxeDev3EnDis"],"RelatedProperties@odata.count":1,"Resolution":"Enter a valid object value and retry the operation. For information about recommended values, see the schema or the attribute registry based on the type of res ource.","Severity":"Warning"},{"Message":"Unable to set the object properties because an incorrect object value is entered.","MessageArgs":["PxeDev4EnDis"],"MessageArgs@odata.count":1,"MessageId":"IDRAC.2.3.SYS409","RelatedProperties":["PxeDev4EnDis"],"RelatedProperties@odata.count":1,"Resolution":"Enter a valid object value and retry the operation. For information about recommended values, see the schema or the attribute registry based on the type of resource.","Severity":"Warning"}],"code":"Base.1.7.GeneralError","message":"A general error has occurred. See ExtendedInfo for more information"}}\n', 'headers': {'Content-Length': '1526', 'Strict-Transport-Security': 'max-age=63072000; includeSubDomains; preload', 'Server': 'Apache', 'Connection': 'close', 'Cache-Control': 'no-cache', 'Date': 'Sun, 24 Oct 2021 11:33:35 GMT', 'OData-Version': '4.0', 'Access-Control-Allow-Origin': '*', 'Content-Type': 'application/json;odata.metadata=minimal;charset=utf-8', 'X-Frame-Options': 'DENY'}, ' url': u'https://X.X.X.X/redfish/v1/Systems/System.Embedded.1/Bios/Settings', 'status_code': 400, '_content_consumed': True, 'encoding': 'utf-8', 'request': <PreparedRequest [PATCH]>, 'connection': <requests.adapters.HTTPAdapter object at 0x7f811de388d0>, 'elapsed': datetime.timedelta(0, 1, 214484), 'raw': <urllib3.response.HTTPResponse object at 0x7f811ddca1d0>, 'reason': 'Bad Request', '_next': None, 'history': []}

The scripts says the params PxeDev2EnDis, PxeDev3EnDis and PxeDev4EnDis doesn't exist, but they are changed and they do exist.

texroemer commented 2 years ago

Hi @OmarReygaert

Attribute values are case sensitive so you must pass in the exact string value as stated in the attribute registry. Change "disabled" to "Disabled" and you script should now pass.

Example of failure and passing:

C:\Python39>GetSetBiosAttributesREDFISH.py -ip 192.168.0.120 -u root -p calvin -an PxeDev3EnDis -av enabled -r n

- INFO, script will be setting BIOS attribute(s) -

Attribute Name: PxeDev3EnDis, setting new value to: enabled

- FAIL, PATCH command failed to set BIOS attribute pending values and create next reboot config job, status code is 400

- POST command failure is:
 {'error': {'@Message.ExtendedInfo': [{'Message': 'Unable to set the object properties because an incorrect object value is entered.', 'MessageArgs': ['PxeDev3EnDis'], 'MessageArgs@odata.count': 1, 'MessageId': 'IDRAC.2.4.SYS409', 'RelatedProperties': ['#/Attributes/PxeDev3EnDis'], 'RelatedProperties@odata.count': 1, 'Resolution': 'Enter a valid object value and retry the operation. For information about recommended values, see the schema or the attribute registry based on the type of resource.', 'Severity': 'Warning'}], 'code': 'Base.1.7.GeneralError', 'message': 'A general error has occurred. See ExtendedInfo for more information'}}

C:\Python39>GetSetBiosAttributesREDFISH.py -ip 192.168.0.120 -u root -p calvin -an PxeDev3EnDis -av Enabled -r n

- INFO, script will be setting BIOS attribute(s) -

Attribute Name: PxeDev3EnDis, setting new value to: Enabled

- PASS: PATCH command passed to set BIOS attribute pending values and create next reboot config job, status code 202 returned

- PASS, JID_351767680522 next reboot config JID successfully created
OmarReygaert commented 2 years ago

Hi @texroemer ,

Thanks for clarification, I was using indeed lowercase values. It seems that this is not a problem for other scripts, like: SetIdracLcSystemAttributesREDFISH.py I'm using also lowercase values and that script pass without error's.

Will use the correct values. Good to know that it is case-sensitive

texroemer commented 2 years ago

Hi @OmarReygaert

FYI, this is not a script issue but a limitation on how the attributes are handled in the background. BIOS has a different attribute registry compared to iDRAC and BIOS enforces case where iDRAC will allow none case values.

Thanks Tex