Actions
Bug #20656
closedInternal server error for GET /api/compliance/policies/:id/tailoring when tailoring file is not associated
Difficulty:
Triaged:
No
Bugzilla link:
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