Subject: | some iLO versions return unclean XML |
Looks like some versions of iLO version 3 return some crap at the bottom
of the XML response that needs to be filtered off.
The attached patch fixes the problem. I don't know whether that's the
best solution or not. I wasn't able to find an option in XML::Simple to
clean it up.
The call to determine the extra version also includes these extra
characters, but that part succeeds.
error message is:
Error parsing response: Entity: line 9: parser error : Extra content at
the end of the document
0
^
It looks like this with debug turned on:
''
'POST /ribcl HTTP/1.1'
'HOST: localhost'
'Content-length: 30'
'Connection: Close'
''
'<RIBCL VERSION="2.0"></RIBCL>'
''
$VAR1 = 'HTTP/1.1 200 OK
Content-Type: text/xml
Date: Mon, 09 Jan 2012 17:26:13 GMT
Cache-Control: no-cache
Expires: Thu, 26 Oct 1995 00:00:00 GMT
Transfer-Encoding: chunked
Server: Allegro-Software-RomPager/4.62
Connection: close<?xml version="1.0"?>
<RIBCL VERSION="2.22">
<RESPONSE
STATUS="0x0000"
MESSAGE=\'No error\'
/>
</RIBCL>
0
^M';
Detected iLO version 3
''
'POST /ribcl HTTP/1.1'
'HOST: localhost'
'Content-length: 214'
'Connection: Close'
''
''
'<?xml version="1.0"?>'
'<LOCFG version="2.21">'
'<RIBCL VERSION="2.0">'
'<LOGIN USER_LOGIN="************" PASSWORD="**********">'
'<SERVER_INFO MODE="read">'
'<GET_HOST_POWER_STATUS/>'
'</SERVER_INFO>'
'</LOGIN>'
'</RIBCL>'
''
$VAR1 = 'HTTP/1.1 200 OK
Content-Type: text/xml
Date: Mon, 09 Jan 2012 17:08:27 GMT
Cache-Control: no-cache
Expires: Thu, 26 Oct 1995 00:00:00 GMT
Transfer-Encoding: chunked
Server: Allegro-Software-RomPager/4.62
Connection: close<?xml version="1.0"?>
<RIBCL VERSION="2.22">
<RESPONSE
STATUS="0x0000"
MESSAGE=\'No error\'
/>
</RIBCL>
<?xml version="1.0"?>
<RIBCL VERSION="2.22">
<RESPONSE
STATUS="0x0000"
MESSAGE=\'No error\'
/>
</RIBCL>
<?xml version="1.0"?>
<RIBCL VERSION="2.22">
<RESPONSE
STATUS="0x0000"
MESSAGE=\'No error\'
/>
</RIBCL>
<?xml version="1.0"?>
<RIBCL VERSION="2.22">
<RESPONSE
STATUS="0x005F"
MESSAGE=\'Login failed.\'
/>
</RIBCL>
0
^M';
Subject: | Net-ILO.patch |
--- ILO.pm.orig 2012-01-09 17:13:05.398761000 -0800
+++ ILO.pm 2012-01-09 17:21:31.440376000 -0800
@@ -1610,6 +1610,9 @@
chomp( my @stanzas = grep { !/HTTP\/1.1/ } split(/<\?xml.*?\?>/, $data) );
+ # clean up the dirty xml stanzas sometimes produced in iLO 3.0
+ s{ > [^<]+ \z }{>}mxs for @stanzas;
+
# @stanzas now contains a number of valid XML sequences.
# All but one is unnecessary; they contain short status messages and
# nothing else. So, we want to parse only the longest message.