Project

General

Profile

Actions

Bug #20656

closed

Internal server error for GET /api/compliance/policies/:id/tailoring when tailoring file is not associated

Added by Ondřej Pražák over 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Target version:
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

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.

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.

Actions

Also available in: Atom PDF