Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gator CLI to render print statements output from rego code to stdout #2949

Closed
jestadi0795 opened this issue Aug 11, 2023 · 2 comments
Closed
Labels
enhancement New feature or request stale

Comments

@jestadi0795
Copy link

Just hoping to see if we can view print statements in rego code to be rendered as output when using Gator CLI so that debugging/developing a policy can be much faster.

Slack Conversation - https://openpolicyagent.slack.com/archives/CDTN970AX/p1691700736253819

@jestadi0795 jestadi0795 added the enhancement New feature or request label Aug 11, 2023
@maxsmythe
Copy link
Contributor

It looks like print statements are not currently printed.

An interim option would be to use the trace() statement and set the --trace flag, which should inject text into the Rego trace. This is probably a better method for development/debug, as more contextual information is provided.

For potential implementation...

Printing could be enabled by setting the appropriate PrintEnabled() and PrintHook() arguments in the Rego driver:

https://github.com/open-policy-agent/frameworks/blob/e24af74adbaeb6c3e9e71d7ef88d63389fa6a3fb/constraint/pkg/client/drivers/rego/args.go#L63-L77

@stale
Copy link

stale bot commented Oct 13, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 13, 2023
@stale stale bot closed this as completed Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale
Projects
None yet
Development

No branches or pull requests

2 participants