Bug 1142808 - Satellite returning error 500 when receiving audit result
Summary: Satellite returning error 500 when receiving audit result
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Satellite 5
Classification: Red Hat
Component: Client
Version: 570
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Matej Kollar
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks: sat570-blockers
TreeView+ depends on / blocked
 
Reported: 2014-09-17 12:48 UTC by Matej Kollar
Modified: 2015-01-13 10:26 UTC (History)
6 users (show)

Fixed In Version: spacewalk-oscap-2.3.0-2-sat
Doc Type: Bug Fix
Doc Text:
Clone Of: 1107841
Environment:
Last Closed: 2015-01-13 10:26:16 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Matej Kollar 2014-09-17 12:48:28 UTC
+++ This bug was initially created as a clone of Bug #1107841 +++

Description of problem:
The client is able to run the scan and generate a proper xml file without any problem

How reproducible:
1. Install spacewalk-oscap
2. Schedule an audit
3. Look at error_log or rrcheck -vvvv output

Actual results:
Results are not inserted in Spacewalk but they are generated

Expected results:
Results inserted in Spacewalk

Additional info from error_log:
[Tue Jun 10 14:25:19 2014] [error] Spacewalk 1237 2014/06/10 14:25:19 -04:00: ('Unhandled exception', IntegrityError('new row for relation "rhnxccdfprofile" violates check constraint "vn_rhnxccdfprofile_identifier"\\nCONTEXT:  Error occurred on dblink connection named "at_conn": could not execute command.\\nSQL statement "SELECT  dblink_exec(\\'at_conn\\',  $1 , true)"\\nPL/pgSQL function "pg_dblink_exec" line 7 at PERFORM\\nSQL statement "SELECT  pg_dblink_exec( \\'insert into rhnXccdfProfile (id, identifier, title) values (\\' ||  $1  || \\', \\' || coalesce(quote_literal( $2 ), \\'NULL\\') || \\', \\' || coalesce(quote_literal( $3 ), \\'NULL\\') || \\')\\' )"\\nPL/pgSQL function "lookup_xccdf_profile" line 12 at PERFORM\\n',))

[Tue Jun 10 14:25:19 2014] [error] Exception Handler Information
[Tue Jun 10 14:25:19 2014] [error] Traceback (most recent call last):
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/lib/python2.6/site-packages/spacewalk/server/apacheRequest.py", line 123, in call_function
[Tue Jun 10 14:25:19 2014] [error]     response = apply(func, params)
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/share/rhn/server/handlers/xmlrpc/queue.py", line 471, in submit
[Tue Jun 10 14:25:19 2014] [error]     action_type=action_type)
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/share/rhn/server/handlers/xmlrpc/queue.py", line 516, in process_extra_data
[Tue Jun 10 14:25:19 2014] [error]     result = method(self.server_id, action_id, data=data)
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/lib/python2.6/site-packages/spacewalk/server/action_extra_data/scap.py", line 46, in xccdf_eval
[Tue Jun 10 14:25:19 2014] [error]     profiles[0], data['errors'])
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/lib/python2.6/site-packages/spacewalk/server/action_extra_data/scap.py", line 64, in _process_testresult
[Tue Jun 10 14:25:19 2014] [error]     errors=errors
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 153, in execute
[Tue Jun 10 14:25:19 2014] [error]     return apply(self._execute_wrapper, (self._execute, ) + p, kw)
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 290, in _execute_wrapper
[Tue Jun 10 14:25:19 2014] [error]     retval = apply(function, p, kw)
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/sql_base.py", line 207, in _execute
[Tue Jun 10 14:25:19 2014] [error]     return self._execute_(args, kwargs)
[Tue Jun 10 14:25:19 2014] [error]   File "/usr/lib/python2.6/site-packages/spacewalk/server/rhnSQL/driver_postgresql.py", line 309, in _execute_
[Tue Jun 10 14:25:19 2014] [error]     self._real_cursor.execute(self.sql, params)
[Tue Jun 10 14:25:19 2014] [error] IntegrityError: new row for relation "rhnxccdfprofile" violates check constraint "vn_rhnxccdfprofile_identifier"
[Tue Jun 10 14:25:19 2014] [error] CONTEXT:  Error occurred on dblink connection named "at_conn": could not execute command.
[Tue Jun 10 14:25:19 2014] [error] SQL statement "SELECT  dblink_exec('at_conn',  $1 , true)"
[Tue Jun 10 14:25:19 2014] [error] PL/pgSQL function "pg_dblink_exec" line 7 at PERFORM
[Tue Jun 10 14:25:19 2014] [error] SQL statement "SELECT  pg_dblink_exec( 'insert into rhnXccdfProfile (id, identifier, title) values (' ||  $1  || ', ' || coalesce(quote_literal( $2 ), 'NULL') || ', ' || coalesce(quote_literal( $3 ), 'NULL') || ')' )"
[Tue Jun 10 14:25:19 2014] [error] PL/pgSQL function "lookup_xccdf_profile" line 12 at PERFORM
[Tue Jun 10 14:25:19 2014] [error]

--- Additional comment from Francis Lacoste on 2014-06-10 14:44:34 EDT ---

Actually, same as: https://www.redhat.com/archives/spacewalk-list/2014-May/msg00059.html

--- Additional comment from Thomas Ristic on 2014-08-12 03:44:08 EDT ---

Any news on this? We are facing the same problem.

--- Additional comment from Šimon Lukašík on 2014-08-12 04:03:11 EDT ---

I believe this is a regression against previous versions of Spacewalk.

--- Additional comment from Jan Chaloupka on 2014-08-14 08:10:48 EDT ---

Hi, Simon,

I am experiencing the same issue, is there a temporary workaround?

--- Additional comment from Šimon Lukašík on 2014-08-15 03:59:51 EDT ---

no.

--- Additional comment from Jan Chaloupka on 2014-08-15 09:58:15 EDT ---

Some output from oscap from client is like this:

<?xml version="1.0" encoding="UTF-8"?>\n<benchmark-resume xmlns:cdf="http://checklists.nist.gov/xccdf/1.1" xmlns:xccdf_12="http://checklists.nist.gov/xccdf/1.2" id="first" version="1.0"><profile title="Tailored profile" id=""/><TestResult id="xccdf_org.open-scap_testresult_default-profile" start-time="2014-08-15T09:44:42" end-time="2014-08-15T09:44:42"><pass><rr id="no_hashes_outside_shadow"><ident system="http://cce.mitre.org">CCE-14300-8</ident></rr></pass><fail/><error/><unknown/><notapplicable/><notchecked/><notselected/><informational/><fixed/></TestResult></benchmark-resume>

It contains

<profile title="Tailored profile" id=""/>

where id attribute is empty string.

Now, looking at /usr/lib/python2.6/site-packages/spacewalk/server/action_extra_data/scap.py, line 45.

All checks for len(profiles) passes, leaving profile.id equal to empty string. DB insert then fails because id has to be non-empty string (due to constraint on id column, table rhnXccdfProfile.

Sent email after exception should sent information about empty id attribute of profile tag.

Looking at source code of master branch, the check is still the same, no check on empty id attribute.

--- Additional comment from Pascal Gamelkoorn on 2014-08-28 10:05:17 EDT ---

Seems that the problem exists when using the default profile. When you provide the profile on the command-line within Spacewalk for openscap it works perfectly. I've reproduced this with multiple XML files with a profile_id provided as parameter. 

Perhaps this can help you guys with searching the issue.

--- Additional comment from Matej Kollar on 2014-09-12 05:29:49 EDT ---

What version of OpenSCAP you use when this occurs?

--- Additional comment from Pascal Gamelkoorn on 2014-09-12 06:47:26 EDT ---

I'm using this version :

openscap-1.0.8-1.0.1
openscap-utils-1.0.8-1.0.1

--- Additional comment from Matej Kollar on 2014-09-17 08:07:12 EDT ---

Thank you Pascal for info.

Patch that introduced this issue seems to be 4140bf90eb3e6b6e303ba41f79c3dec7fb24d676.

In the meantime people suffering from this can try downgrading to spacewalk-oscap-0.0.22. (Only difference there should be change in xslt and list of allowed arguments related to enabling support for tailoring).

Comment 1 Matej Kollar 2014-09-24 06:54:21 UTC
Fixed upstream

spacewalk.git: 436604669a3496775e01beea1c6266d4c545d8ee

Comment 4 Matej Kollar 2014-10-01 17:15:18 UTC
Example of testing with openscap-content, explicitely stating profile:

  Command-line Arguments: --profile RHEL6-Default
  Path to XCCDF document *: /usr/share/openscap/scap-rhel6-xccdf.xml

Comment 6 Lukáš Hellebrandt 2014-12-04 13:27:11 UTC
Verified.

There is not traceback with nor without profile specified and the data are being inserted to the Satellite.

Comment 7 Clifford Perry 2015-01-13 10:26:16 UTC
With the release of Red Hat Satellite 5.7 on January 12th 2015 this bug is
being moved to a Closed Current Release state. 

The Satellite 5.7 GA Errata:
 - https://rhn.redhat.com/errata/RHSA-2015-0033.html 

Satellite 5.7 Release Notes:
 -
https://access.redhat.com/documentation/en-US/Red_Hat_Satellite/5.7/html-single/Release_Notes/index.html

Satellite Customer Portal Blog announcement for release:
 - https://access.redhat.com/blogs/1169563/posts/1315743 

Cliff

NOTE: This bug has not been re-verified (moved to RELEASE_PENDING) prior to release. We assume that the bug has indeed been fixed and not regressed since we initially verified it. Please re-open in the future if needed.


Note You need to log in before you can comment on or make changes to this bug.