Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1482393 - Internal server error for GET /api/compliance/policies/:id/tailoring when tailoring file is not associated
Summary: Internal server error for GET /api/compliance/policies/:id/tailoring when tai...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: SCAP Plugin
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: Unspecified
Assignee: Ondřej Pražák
QA Contact: Nikhil Kathole
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-08-17 07:25 UTC by Nikhil Kathole
Modified: 2019-09-26 15:38 UTC (History)
6 users (show)

Fixed In Version: foreman-openscap-0.7.5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:51:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
log in production.log file (15.44 KB, text/plain)
2017-08-17 07:25 UTC, Nikhil Kathole
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 20656 0 None None None 2017-08-21 08:25:36 UTC

Description Nikhil Kathole 2017-08-17 07:25:13 UTC
Created attachment 1314582 [details]
log in production.log file

Description of problem: API GET /api/compliance/policies/:id/tailoring results in 

"undefined method `scap_file' for nil:NilClass"

when tailoring file is not associated with compliance policy and log file shows 500 Internal server error.

Version-Release number of selected component (if applicable): sat 6.3 snap 11


How reproducible: always


Steps to Reproduce:
1. Create compliance policy with scap content (do not associate tailoring file) 
2.  curl -s -X GET -k -u admin:<password>  'https://$HOST/api/v2/compliance/policies/1/tailoring'

Actual results:
Results in 

{
  "error": {"message":"undefined method `scap_file' for nil:NilClass"}
}

and tail -f /var/log/foreman/production.log shows Internal server error 500.

Expected results:

Error should get handled and proper message should be displayed.

Additional info:
For sat 6.3 snap 11, GET 'https://$HOST/api/compliance/policies/1/tailoring' will not work. Try GET 'https://$HOST/api/v2/compliance/policies/1/tailoring'.
Refer BZ #1482383.

Comment 2 Ondřej Pražák 2017-08-21 08:25:33 UTC
Created redmine issue http://projects.theforeman.org/issues/20656 from this bug

Comment 3 Satellite Program 2017-08-21 10:15:18 UTC
Upstream bug assigned to oprazak

Comment 4 Satellite Program 2017-08-21 10:15:22 UTC
Upstream bug assigned to oprazak

Comment 5 Satellite Program 2017-08-25 16:15:00 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/20656 has been resolved.

Comment 6 Nikhil Kathole 2017-09-10 06:39:49 UTC
VERIFIED

Version Tested:
Satellite-6.3 Snap 15

steps:
1. Created scap policy without assigning tailoring file
2. curl -s -X GET -k -u admin:password  'https://$HOST/api/v2/compliance/policies/2/tailoring'

Shows valid message as 

{"error":{"message":"No Tailoring file assigned for policy with id 2"}}

Comment 7 Satellite Program 2018-02-21 16:51:07 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://access.redhat.com/errata/RHSA-2018:0336


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