HewlettPackard / python-redfish-utility

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

UnboundLocalError(local variable 'data' referenced before assignment) #21

Closed emmapeng321 closed 3 years ago

emmapeng321 commented 4 years ago
-sh-4.2# /usr/sbin/ilorest -v -d serverinfo --fan
iLOrest : RESTful Interface Tool version 2.5
Copyright (c) 2014, 2019 Hewlett Packard Enterprise Development LP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INFO    : Exception: UnboundLocalError(local variable 'data' referenced before assignment)
ERROR: local variable 'data' referenced before assignment
Traceback (most recent call last):
  File "rdmc.py", line 298, in run
  File "rdmc.py", line 186, in _run_command
  File "extensions/iLO COMMANDS/ServerInfoCommand.py", line 70, in run
  File "extensions/iLO COMMANDS/ServerInfoCommand.py", line 139, in gatherinfo
UnboundLocalError: local variable 'data' referenced before assignment
ILOREST return code: 255
-sh-4.2# rpm -qa | grep ilorest
ilorest-2.5.0-22.x86_64
Yergidy commented 4 years ago

Thanks for the submit. We will take a look and see if we can reproduce.

emmapeng321 commented 4 years ago

The issue goes away if we run ilorest first. But we would like to know if there's a solution without running ilorest first.

-sh-4.2# ilorest serverinfo --fan
iLOrest : RESTful Interface Tool version 2.5
Copyright (c) 2014, 2019 Hewlett Packard Enterprise Development LP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ERROR: local variable 'data' referenced before assignment

-sh-4.2# ilorest
iLOrest : RESTful Interface Tool version 2.5
Copyright (c) 2014, 2019 Hewlett Packard Enterprise Development LP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iLOrest > exit
Logging session out.
Bye for now

-sh-4.2# ilorest serverinfo --fan
iLOrest : RESTful Interface Tool version 2.5
Copyright (c) 2014, 2019 Hewlett Packard Enterprise Development LP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Local login initiated...
Discovering data...Done
Yergidy commented 4 years ago

It looks like it may be an issue with serverinfo parsing login. Can you run ilorest login first and then ilorest serverinfo --fan and see if that works? Also, can you try with the latest release if that doesn't work? 3.0 just came out a few days ago. https://github.com/HewlettPackard/python-redfish-utility/releases/latest

emmapeng321 commented 4 years ago

Running ilorest login first will fix our issue! Thanks! We are not allowed to install 3.0 yet but will give it a try as well once we can upgrade.

Yergidy commented 4 years ago

Thank you. I will keep this open until we have confirmation the issue is fixed on iLOrest 3.0.

rajeevkallur commented 3 years ago

Fixed in 3.1 image