Add Filter & Field Validation in reports_workflow_manager #191
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of Change
Description
This PR fixes two validation bugs in the reports_workflow_manager module where invalid filter names and invalid field values were accepted by the module and passed to the API without triggering any errors.
These issues caused the module to execute successfully even with malformed report configurations, leading to silent failures and incorrect report creation.
This change ensures consistent validation behavior across all templates and enforces strict schema compliance before any API call is made.
Bug Fixes Included
This update resolves critical validation gaps where invalid filter names and invalid field group fields were silently accepted, resulting in incorrect report creation without any error feedback.
Root Cause
The filter validation logic did not enforce:
Presence of required filters per template
Correct filter types
Detection of unknown filters
Field validation logic did not validate:
Expected fieldGroupName per template
Required field names
Extra/invalid field names
This incomplete schema validation allowed malformed report definitions to pass through undetected.
Fix Implemented
A unified validation framework has been introduced across all templates:
Filter Validation Enhancements
Added strict enforcement of required filters.
Validation now checks:
Missing filters
Incorrect filter types
Unknown/unexpected filters
Upon validation failure, the module now correctly returns error msg.
ensuring the Ansible task fails instead of succeeding silently.
Field Group Validation Enhancements
Added template-specific validation for:
Correct fieldGroupName
Required field names
Detection of invalid/unknown field names
Invalid field groups now result in an explicit failure.
Testing Done:
Test cases covered: [Mention test case IDs or brief points]
Checklist
Ansible Best Practices
ansible-vaultor environment variables)Documentation
Screenshots (if applicable)
Notes to Reviewers