python-hpilo icon indicating copy to clipboard operation
python-hpilo copied to clipboard

KeyError: 'transfer-encoding'

Open imillerx opened this issue 5 years ago • 9 comments

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'<RIBCL VERSION="2.0"></RIBCL>', 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

imillerx avatar Jul 22 '20 11:07 imillerx

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.

seveas avatar Jul 22 '20 12:07 seveas

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 avatar Jul 22 '20 12:07 imillerx

$ 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 avatar Jul 22 '20 13:07 imillerx

here's the saved response file r.txt

imillerx avatar Jul 22 '20 13:07 imillerx

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

imillerx avatar Jul 22 '20 13:07 imillerx

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 ?

seveas avatar Jul 22 '20 13:07 seveas

$ python hpilo_cli. 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 avatar Jul 22 '20 13:07 imillerx

and here's the saved response r2.txt

imillerx avatar Jul 22 '20 13:07 imillerx

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 ?

imillerx avatar Jul 23 '20 17:07 imillerx