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

Allow opa inspect to inspect a single file #6799

Closed
anderseknert opened this issue Jun 6, 2024 · 2 comments · Fixed by #6873
Closed

Allow opa inspect to inspect a single file #6799

anderseknert opened this issue Jun 6, 2024 · 2 comments · Fixed by #6873

Comments

@anderseknert
Copy link
Member

It's not often I get to use opa inspect, but when I do, it's often to help me understand how annotations have been processed in a file. However..

> opa inspect -a p.rego
error: bundle p.rego: bundle read failed: archive read failed: gzip: invalid header

In order to get the output I want, I have to do something like this:

> mkdir tmp
> cp p.rego tmp/
> opa inspect -a tmp
NAMESPACES:
+-------------+------------+
|  NAMESPACE  |    FILE    |
+-------------+------------+
| data.policy | tmp/p.rego |
+-------------+------------+
ANNOTATIONS:
allow
=====

Package:  policy
Rule:     allow
Location: tmp/p.rego:7
Scope: rule

Nothing in that output is specific to bundles, and there's no obvious connection between the bundle format and annotations. The documentaton section on annotations covering this also makes no mention of that requirement:

Annotations can be listed through the inspect command by using the -a flag:
opa inspect -a

Having to copy the file into a directory that can be treated as a bundle is... not a great experience. Dropping the bundle requirement and allow inspecting single files as they are would be one solution. But even if we keep the bundle requirement, perhaps pointing opa inspect at a single file could just mean "as if it was the only file in a bundle directory". Basically doing what the user currently has to do for it to work.

Copy link

stale bot commented Jul 12, 2024

This issue has been automatically marked as inactive because it has not had any activity in the last 30 days. Although currently inactive, the issue could still be considered and actively worked on in the future. More details about the use-case this issue attempts to address, the value provided by completing it or possible solutions to resolve it would help to prioritize the issue.

@tjons
Copy link
Contributor

tjons commented Jul 17, 2024

Added #6873 to resolve this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants