-
Feature Request
-
Resolution: Unresolved
-
Undefined
-
None
-
2.6
-
False
-
-
False
- What is the nature and description of the request?
Policy validation output is malformed on the AAP UI.
PFA- screenshot
Example OPA policies that we used for inspiration:
https://github.com/ansible/example-opa-policy-for-aap/blob/main/aap_policy_examples/jt_naming_validation.rego
in awx/main/tasks/policy.py
(available in automation-controller-task), the ouput from OPA is being mangled.
if violations or errors:
raise PolicyEvaluationError(pformat(format_results, width=80))
The result of this is the attached screenshot.
While we can have great level of detail in our policy validation/error messages, it doesn't help our users know how to handle the issues if the output is mangled.
Recommended approach:
When aap wants to print a json structure, print it from a new line and pretty print it with low level of indentation.
If the output is wide enough that it should break up into multiple lines, respect the column boundary of the property with wide content.
Ideally, it should also respect linebreaks in the response.
The other option, if not presenting a json structure, would be to use default line breaking, not handling it via pformat that breaks it up into multiple strings with quotes.
Describe the impact to you or the business
Our users get confused by the mangled output and don't understand quickly what to do to adhere to our opa ruleset.