seveas / python-hpilo

Accessing the HP iLO XML interface from python

Home Page:https://seveas.github.io/python-hpilo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

update_rib_firmware fails with after updating to 4.0

schindlerd opened this issue · comments

Hi,

after updating to version 4.0 I'm having trouble when running "update_rib_firmware" via hpilo_cli.

It fails with:
# hpilo_cli -c .ilo.conf server.myexample.local update_rib_firmware version=latest
Traceback (most recent call last):
File "/usr/bin/hpilo_cli", line 334, in <module>
main()
File "/usr/bin/hpilo_cli", line 214, in main
results = [getattr(ilo, method)(**params)]
File "/usr/lib/python2.7/site-packages/hpilo.py", line 1847, in update_rib_firmware
config = hpilo_fw.config(self.firmware_mirror)
File "/usr/lib/python2.7/site-packages/hpilo_fw.py", line 32, in config
parser.readfp(io.StringIO(conf))
TypeError: initial_value must be unicode or None, not str

My system specs are:
Oracle Linux Server release 7.4
python-hpilo-4.0-1.1.noarch
Python 2.7.5

Thanks in advance :)

In case of PY 2 this does not work.

**Traceback (most recent call last):
File "/usr/bin/hpilo_cli", line 334, in
main()
File "/usr/bin/hpilo_cli", line 214, in main
results = [getattr(ilo, method)(params)]
File "/usr/lib/python2.7/dist-packages/hpilo.py", line 1847, in update_rib_firmware
config = hpilo_fw.config(self.firmware_mirror)
File "/usr/lib/python2.7/dist-packages/hpilo_fw.py", line 33, in config
parser.readfp(io.StringIO(conf))
TypeError: initial_value must be unicode or None, not str

This needs to change in hpilo_fw.py to
if PY3:
conf = conf.decode('ascii')
else:
conf = conf.decode('unicode-escape')

Thanks :) this fixes it for hpilo_fw.py but leads to another traceback in hpilo.py

# hpilo_cli -c .ilo.conf server.myexample.local update_rib_firmware version=latest
Downloading ilo4 firmware version 2.55 16784156/16784156 bytes (100%)Traceback (most recent call last):
File "/usr/bin/hpilo_cli", line 334, in <module>
main()
File "/usr/bin/hpilo_cli", line 214, in main
results = [getattr(ilo, method)(**params)]
File "/usr/lib/python2.7/site-packages/hpilo.py", line 1872, in update_rib_firmware
self._upload_file(filename, progress)
File "/usr/lib/python2.7/site-packages/hpilo.py", line 283, in _upload_file
while boundary in firmware:
NameError: global name 'firmware' is not defined

I think there's a typo in line 281

"firwmware = fd.read()" should actually say "firmware = fd.read()"