seveas / python-hpilo

Accessing the HP iLO XML interface from python
https://seveas.github.io/python-hpilo
Other
320 stars 101 forks source link

update_rib_firmware fails with after updating to 4.0 #156

Closed schindlerd closed 7 years ago

schindlerd commented 7 years ago

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 :)

hussamnasir commented 7 years ago

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')

schindlerd commented 7 years ago

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

pbulteel commented 7 years ago

I think there's a typo in line 281

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

schindlerd commented 7 years ago

Thanks a lot @hussamnasir #159 and @pbulteel #158 👍