Bug #20656
closedInternal server error for GET /api/compliance/policies/:id/tailoring when tailoring file is not associated
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.
Updated by The Foreman Bot over 7 years ago
- Status changed from New to Ready For Testing
- Assignee set to Ondřej Pražák
- Pull request https://github.com/theforeman/foreman_openscap/pull/277 added
Updated by Marek Hulán over 7 years ago
- Subject changed from Internal server error for GET /api/compliance/policies/:id/tailoring when tailoring file is not associated to Internal server error for GET /api/compliance/policies/:id/tailoring when tailoring file is not associated
- Target version set to 1.18.0-RC2
- Translation missing: en.field_release set to 274
Updated by Ondřej Pražák over 7 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset foreman_openscap|323fe7866a4956a0e9780e6117e3bbf4c8bad26c.