Bug 1205644

Summary: RHEL6 cloud certification traceback on saving results file after openscap test
Product: Red Hat Certification Program Reporter: Greg Nichols <gnichols>
Component: redhat-certificationAssignee: Greg Nichols <gnichols>
Status: CLOSED ERRATA QA Contact: Brian Brock <bbrock>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 1.0CC: brose, gnichols, sgupta
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: redhat-certification-1.0-20150325 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1217203 (view as bug list) Environment:
Last Closed: 2015-05-12 08:19:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1217203    

Description Greg Nichols 2015-03-25 11:39:08 UTC
Description of problem:

While running redhat-certification-cloud-3.0-2.el6.noarch on el6 with redhat-certification-1.0-20150324.1.el6, I get the following traceback while saving attachments. 

$ sudo rhcert-backend run

/usr/lib/python2.6/site-packages/rhcert/crypto.py:16: DeprecationWarning: the md5 module is deprecated; use hashlib instead
  import os, md5, M2Crypto, magic
Verifying test plan
Warning: default plan called
Created a new plan with 2 tests

Running the following tests:
openscap                                       
sos_ccp                                        

Test Verification Passed
Running openscap
Running openscap checks ...   ...  Done
copying attachments...
checking directory /var/log/rhcert/runs/1/cloud/openscap 
Adding /var/log/rhcert/runs/1/cloud/openscap/ssg-results.html
copied attachment file ssg-results.html
Adding /var/log/rhcert/runs/1/cloud/openscap/ssg-errors.log
copied attachment file ssg-errors.log
Adding /var/log/rhcert/runs/1/cloud/openscap/ssg-results.xml
copied attachment file ssg-results.xml
Skipping output.log
saveOutput: /var/log/rhcert/runs/1/cloud/openscap/output.log
Return value was True
Traceback (most recent call last):
  File "/usr/bin/rhcert-backend", line 37, in <module>
    success = rhcertBackend.do(args)
  File "/usr/lib/python2.6/site-packages/rhcert/client/backend.py", line 171, in do
    result = self.commands[self.command]()
  File "/usr/lib/python2.6/site-packages/rhcert/client/harness.py", line 376, in doRun
    return self._doRun(testDocuments)
  File "/usr/lib/python2.6/site-packages/rhcert/client/harness.py", line 544, in _doRun
    self.certification.save(self.environment.getResultsPath())
  File "/usr/lib/python2.6/site-packages/rhcert/documentbase.py", line 300, in save
    self.__saveXML(filePath)
  File "/usr/lib/python2.6/site-packages/rhcert/documentbase.py", line 305, in __saveXML
    xmlfile.write(self.document.toxml())
  File "/usr/lib64/python2.6/xml/dom/minidom.py", line 45, in toxml
    return self.toprettyxml("", "", encoding)
  File "/usr/lib64/python2.6/xml/dom/minidom.py", line 57, in toprettyxml
    self.writexml(writer, "", indent, newl, encoding)
  File "/usr/lib64/python2.6/xml/dom/minidom.py", line 1749, in writexml
    node.writexml(writer, indent, addindent, newl)
  File "/usr/lib64/python2.6/xml/dom/minidom.py", line 817, in writexml
    node.writexml(writer,indent+addindent,addindent,newl)
  File "/usr/lib64/python2.6/xml/dom/minidom.py", line 817, in writexml
    node.writexml(writer,indent+addindent,addindent,newl)
  File "/usr/lib64/python2.6/xml/dom/minidom.py", line 817, in writexml
    node.writexml(writer,indent+addindent,addindent,newl)
  File "/usr/lib64/python2.6/xml/dom/minidom.py", line 812, in writexml
    _write_data(writer, attrs[a_name].value)
  File "/usr/lib64/python2.6/xml/dom/minidom.py", line 301, in _write_data
    data = data.replace("&", "&amp;").replace("<", "&lt;")
AttributeError: 'NoneType' object has no attribute 'replace'



Version-Release number of selected component (if applicable):

redhat-certification-cloud-3.0-2.el6.noarch
redhat-certification-1.0-20150324.1.el6

Comment 1 Greg Nichols 2015-03-25 11:43:50 UTC
I assume this does not happen on RHEL7 hosts?

Could you attach the xml attachments the test produces?   The should still be in /var/log/rhcert/run.../<test name> etc. after the test runs.

Comment 2 Shreyank Gupta 2015-03-25 11:59:42 UTC
(In reply to Greg Nichols from comment #1)
> I assume this does not happen on RHEL7 hosts?
> 
No it doesn't. 

> Could you attach the xml attachments the test produces?   The should still
> be in /var/log/rhcert/run.../<test name> etc. after the test runs.

I have isolated the issue to be a python bug [1], fixed in 2.7 but not backported to the python2.6 build that Red Hat ships.

[1] https://bugs.python.org/issue5762

Comment 5 Brian Brock 2015-04-20 21:01:48 UTC
tested with 20150420

openscap doesn't traceback, but it dies very early and I can't yet tell whether it's reached the point when the traceback would occur.

# cat /var/log/rhcert/runs/1//cloud/openscap/output.log 
<output>
Running openscap checks ...  Error
</output>

# cat /var/log/rhcert/runs/1//cloud/openscap/ssg-errors.log 
OpenSCAP Error: Unable to open file: '/usr/share/xml/scap/ssg/content/ssg-rhel6-xccdf.xml' [oscapxml.c:575]

closest match for filename that I see:

# ls -l /usr/share/xml/scap/ssg/content/ssg-rhel6-ds.xml 
-rw-r--r--. 1 root root 3029625 Oct 21 10:56 /usr/share/xml/scap/ssg/content/ssg-rhel6-ds.xml

Comment 6 Brian Brock 2015-04-20 21:02:32 UTC
previous test was marked as a fail in the wui.

Comment 7 Shreyank Gupta 2015-04-21 06:52:55 UTC
(In reply to Brian Brock from comment #5)
> tested with 20150420
> 
> openscap doesn't traceback, but it dies very early and I can't yet tell
> whether it's reached the point when the traceback would occur.
> 
> # cat /var/log/rhcert/runs/1//cloud/openscap/output.log 
> <output>
> Running openscap checks ...  Error
> </output>
> 
> # cat /var/log/rhcert/runs/1//cloud/openscap/ssg-errors.log 
> OpenSCAP Error: Unable to open file:
> '/usr/share/xml/scap/ssg/content/ssg-rhel6-xccdf.xml' [oscapxml.c:575]
> 
> closest match for filename that I see:
> 
> # ls -l /usr/share/xml/scap/ssg/content/ssg-rhel6-ds.xml 
> -rw-r--r--. 1 root root 3029625 Oct 21 10:56
> /usr/share/xml/scap/ssg/content/ssg-rhel6-ds.xml

You need to yum install scap-security-guide and openscap-utils on the SUT. This is mentioned as part of Docs.

Comment 8 Brian Brock 2015-04-29 18:24:53 UTC
shouldn't this be rpm %require'd, if it's mandatory?

Comment 9 Greg Nichols 2015-04-29 18:45:52 UTC
(In reply to Brian Brock from comment #8)
> shouldn't this be rpm %require'd, if it's mandatory?

Cloned to 1217203

Comment 10 Brian Brock 2015-04-29 21:10:27 UTC
bug 1208724 describes what I'm seeing, completely.

Verifying this bug as fixed; there's no exception thrown & traceback in 20150420

Comment 12 errata-xmlrpc 2015-05-12 08:19:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0959.html