The script currently reads the templates directory for all templates, and submits them to OPA for validation one by one.
It would be a great improvement if we instead allowed the user to point the tool at either a single template, or a directory. This would allow them to use the same tool for their own policy authoring, where they'd run OPA locally, and submitted templates converted to JSON to OPA, and have the script return the output. Suggested steps, but these are very much just some ideas:
Rename to validate.py (or whatever is appropriate)
Allow argument to point out single template, or directory, which will be submitted to OPA (localhost:8181 hardcoding is fine).
By default, we shouldn't "test" the returned response but rather just print it to the console, nicely formatted.
When provided a --test flag or similar, we do what we currently do and print FAIL, SUCCESS, and so on.
Add some docs to explain what the tool does and how to use it.
The script currently reads the
templates
directory for all templates, and submits them to OPA for validation one by one.It would be a great improvement if we instead allowed the user to point the tool at either a single template, or a directory. This would allow them to use the same tool for their own policy authoring, where they'd run OPA locally, and submitted templates converted to JSON to OPA, and have the script return the output. Suggested steps, but these are very much just some ideas:
validate.py
(or whatever is appropriate)--test
flag or similar, we do what we currently do and print FAIL, SUCCESS, and so on.