seveas / python-hpilo

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

KeyError: 'transfer-encoding' #232

Open imillerx opened 4 years ago

imillerx commented 4 years ago

I'm seeing this error message when trying to talk to a iLo3 on a rx2800 i2

$ python hpilo_cli. 10.59.255.37 -d --login="Administrator" --password="PASSWORD" get_embedded_health Connecting to 10.59.255.37 port 443 Sending XML request, 132 bytes Received 3446 bytes Traceback (most recent call last): File "hpilo_cli.", line 334, in main() File "hpilo_cli.", line 214, in main results = [getattr(ilo, method)(**params)] File "hpilo.py", line 1041, in get_embedded_health process=process) File "hpilo.py", line 734, in _info_tag header, message = self._request(root) File "hpilo.py", line 238, in _request self._detect_protocol() File "hpilo.py", line 278, in _detect_protocol header, data = self._communicate(b'', ILO_HTTP, save=False) File "hpilo.py", line 509, in _communicate if header['transfer-encoding'] == 'chunked': KeyError: 'transfer-encoding'

$ python hpilo_cli. -v 4.3 $ python --version Python 2.7.18 [ on a HPE rx2800 i2 running OpenVMS V8.4 ] iLO FW : 02.01.03 which is the most recent version for this server

seveas commented 4 years ago

You left your password in there. I edited it out, but you may want to change that password 😞

02.01.03 is not a known version number, are you sure this is an ilo? If you change line 509 to if header.get('transfer-encoding', '') == 'chunked': it should get beyond this point, but given that it's behaving quite differently from what I know, I don't know how far it will get.

imillerx commented 4 years ago

According to HPSC iLO-3 Firmware Version: 02.01.03 is the most recent version for this server. HPE Integrity Servers are not so common so may be few have tried this.

[ although this iLo is not accessible from anywhere outside of a firewalled LAN it was silly of me to include the password and I have changed it ].

imillerx commented 4 years ago

$ python hpilo_cli. x.x.x.x -d --save-response=r.txt --login="Administrator" --password=PASSWORD get_fw_version Connecting to x.x.x.x port 443 Sending XML request, 132 bytes Received 3446 bytes Connecting to x.x.x.x port 443 Sending XML request, 283 bytes Received 3446 bytes hpilo.py:557: IloXMLWarning: iLO returned malformed XML, attempting to fix. Please contact HP to report a bug warnings.warn("iLO returned malformed XML, attempting to fix. Please contact HP to report a bug", IloXMLWarning) Traceback (most recent call last): File "hpilo_cli.", line 334, in main() File "hpilo_cli.", line 214, in main results = [getattr(ilo, method)(**params)] File "hpilo.py", line 1183, in get_fw_version return self._info_tag('RIB_INFO', 'GET_FW_VERSION') File "hpilo.py", line 734, in _info_tag header, message = self._request(root) File "hpilo.py", line 253, in _request message = self._parse_message(data) File "hpilo.py", line 592, in _parse_message message = self._attempt_to_fix_broken_xml(data) File "hpilo.py", line 572, in _attempt_to_fix_broken_xml return etree.fromstring(data) File "/python_root/lib/xml/etree/ElementTree.py", line 1311, in XML parser.feed(text) File "/python_root/lib/xml/etree/ElementTree.py", line 1659, in feed self._raiseerror(v) File "/python_root/lib/xml/etree/ElementTree.py", line 1523, in _raiseerror raise err xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 91, column 5

imillerx commented 4 years ago

here's the saved response file r.txt

imillerx commented 4 years ago

I would be disappointed but not entirely surprised to discover this server iLo is too prehistoric for this software

seveas commented 4 years ago

Heh, python-hpilo still supports the original ilo 1. But yeah, I only ever use(d) it on proliants, not integrity servers. It looks like the protocol autodetection thinks you should be using http to talk to the ilo, but actually doing this fails and you get some html document back. Can you try with --protocol raw ?

imillerx commented 4 years ago

$ python hpilocli. 10.59.255.37 -d --protocol raw --save-response=r.txt --login="Administrator" --password="PASSWORD" get fw_version Connecting to 10.59.255.37 port 443 Sending XML request, 202 bytes Received 146 bytes Traceback (most recent call last): File "hpilo_cli.", line 334, in main() File "hpilo_cli.", line 214, in main results = [getattr(ilo, method)(**params)] File "hpilo.py", line 1183, in get_fw_version return self._info_tag('RIB_INFO', 'GET_FW_VERSION') File "hpilo.py", line 734, in _info_tag header, message = self._request(root) File "hpilo.py", line 246, in _request header, data = self._communicate(xml, self.protocol, progress=progress) File "hpilo.py", line 527, in _communicate raise IloError("Remote returned bogus data, maybe it's not an iLO") hpilo.IloError: Remote returned bogus data, maybe it's not an iLO

imillerx commented 4 years ago

and here's the saved response r2.txt

imillerx commented 4 years ago

I guess the key part of that response is at the end "The requested method is not recognized by this server." Any thoughts on how to find out what methods are available ?