HewlettPackard / python-redfish-utility

Python-based utility for interacting with devices supporting a Redfish Service
Other
86 stars 41 forks source link

Better error handling when bios registries are not available #8

Closed krisstoffe closed 2 years ago

krisstoffe commented 5 years ago

Environment :

The issue :

Every command to set properties with ilorest in this environment results in :

ERROR: 'NoneType' object has no attribute 'lower'``

On Proliant Gen9 servers with ILO 4 (CentOS 7.4 and ilorest 2.3.4), there is no issue at all

How to reproduce the bug :

# ilorest
iLOrest : RESTful Interface Tool version 2.3
Copyright (c) 2014, 2018 Hewlett Packard Enterprise Development LP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iLOrest > select Bios.v1_0_0
Local login initiated...
Discovering data...Done
iLOrest > get ProcSMT
ProcSMT=Enabled
iLOrest > set "ProcSMT=Disabled"
ERROR: 'NoneType' object has no attribute 'lower'
iLOrest >
Yergidy commented 5 years ago

@krisstoffe Thanks for reporting the issue. We will take a look.

Yergidy commented 5 years ago

Sorry, I can't reproduce on my end. Can you run the commands with iLOrest in debug mode?(ilorest -d) and paste the traceback you are seeing?

krisstoffe commented 5 years ago

@Yergidy, sure : here is the debug output while setting "ProcSMT=disabled"

iLOrest > get ProcSMT
ProcSMT=Enabled
iLOrest > 
iLOrest > 
iLOrest > set ProcSMT=Disabled
DEBUG   : _loading /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30/
DEBUG   : Blobstore REQUEST: GET
    PATH: {'OData-Version': '4.0', 'Connection': 'Keep-Alive', 'Accept': '*/*', 'X-Auth-Token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}
    HEADERS: /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30/
    BODY: None
INFO    : iLO Response Time to /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30/: 0.00934195518494 secs.
DEBUG   : Blobstore RESPONSE for /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30/:
Code: 204 No
Headers:
    content-length: 0
    content-encoding: gzip
    x_hp-chrp-service-version: 1.0.3
    connection: keep-alive
    allow: GET, HEAD
    date: Fri, 18 Jan 2019 08:59:22 GMT
    odata-version: 4.0
    x-frame-options: sameorigin
    x-host-auth-method-used: Session

Body of /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30/: 
DEBUG   : Blobstore REQUEST: GET
    PATH: {'OData-Version': '4.0', 'Connection': 'Keep-Alive', 'Accept': '*/*', 'X-Auth-Token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}
    HEADERS: /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30//
    BODY: None
INFO    : iLO Response Time to /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30//: 0.00818300247192 secs.
DEBUG   : Blobstore RESPONSE for /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30/:
Code: 204 No
Headers:
    content-length: 0
    content-encoding: gzip
    x_hp-chrp-service-version: 1.0.3
    connection: keep-alive
    allow: GET, HEAD
    date: Fri, 18 Jan 2019 08:59:22 GMT
    odata-version: 4.0
    x-frame-options: sameorigin
    x-host-auth-method-used: Session

Body of /redfish/v1/registrystore/registries/en/biosattributeregistrya41.v1_1_30/: 
DEBUG   : _loading /redfish/v1/schemastore/en/bios.v1_0_0.json/
DEBUG   : Blobstore REQUEST: GET
    PATH: {'OData-Version': '4.0', 'Connection': 'Keep-Alive', 'Accept': '*/*', 'X-Auth-Token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}
    HEADERS: /redfish/v1/schemastore/en/bios.v1_0_0.json/
    BODY: None
INFO    : iLO Response Time to /redfish/v1/schemastore/en/bios.v1_0_0.json/: 0.00839996337891 secs.
DEBUG   : Blobstore RESPONSE for /redfish/v1/schemastore/en/bios.v1_0_0.json/:
Code: 204 No
Headers:
    content-length: 0
    content-encoding: gzip
    x_hp-chrp-service-version: 1.0.3
    connection: keep-alive
    allow: GET, HEAD
    date: Fri, 18 Jan 2019 08:59:22 GMT
    odata-version: 4.0
    x-frame-options: sameorigin
    x-host-auth-method-used: Session

Body of /redfish/v1/schemastore/en/bios.v1_0_0.json/: 
DEBUG   : Blobstore REQUEST: GET
    PATH: {'OData-Version': '4.0', 'Connection': 'Keep-Alive', 'Accept': '*/*', 'X-Auth-Token': 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'}
    HEADERS: /redfish/v1/schemastore/en/bios.v1_0_0.json//
    BODY: None
INFO    : iLO Response Time to /redfish/v1/schemastore/en/bios.v1_0_0.json//: 0.00844883918762 secs.
DEBUG   : Blobstore RESPONSE for /redfish/v1/schemastore/en/bios.v1_0_0.json/:
Code: 204 No
Headers:
    content-length: 0
    content-encoding: gzip
    x_hp-chrp-service-version: 1.0.3
    connection: keep-alive
    allow: GET, HEAD
    date: Fri, 18 Jan 2019 08:59:22 GMT
    odata-version: 4.0
    x-frame-options: sameorigin
    x-host-auth-method-used: Session

Body of /redfish/v1/schemastore/en/bios.v1_0_0.json/: 
INFO    : Exception: AttributeError('NoneType' object has no attribute 'lower')
ERROR: 'NoneType' object has no attribute 'lower'
Traceback (most recent call last):
  File "<string>", line 362, in cmdloop
  File "<string>", line 181, in _run_command
  File "extensions/COMMANDS/SetCommand.py", line 202, in run
  File "extensions/COMMANDS/SetCommand.py", line 160, in setfunction
AttributeError: 'NoneType' object has no attribute 'lower'
iLOrest >
Yergidy commented 5 years ago

@krisstoffe Thanks. I'll take a look.

Yergidy commented 5 years ago

It looks like we cannot get the bios registries from the system. We are talking with the bios team to see what could be going on.

krisstoffe commented 5 years ago

@Yergidy, after digging once again in the online documentation of ilorest, I found a tip

Clearrestapistate command

Some types such as Bios, Icsci, and SmartStorageConfig will not be available until a system reboot occurs after running this command.

Guess what ... It worked ... So, my mistake ... And as usual, RTFM ! ^^ Perhaps the error returned by ilorest in this case could be a little more explicit ?

Yergidy commented 5 years ago

@krisstoffe Great! Glad your issue was solved. I agree our error handling could be better here. Lets change this to an enhancement request.

sahanaramavana commented 2 years ago

Hi @krisstoffe ,

while we try to set the properties using set command we are not seeing exception on our newly released product of iLORest .

Kindly check it on iLORest 3.3.0 and let us know if the exceptions are thrown .

We have put up unhandled exception handling code pieces where required .

Thanks & Regards, iLORest Team