You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Although it is a bit of an edge case, I think it's meant to be supported using another bundle as the source when building a new bundle, adding e.g. another directory or policy to the second bundle. There seems to be a problem when merging two empty (i.e. containing {}) data.json files though.
The command works alright, but trying to run OPA with bundle2.tar.gz fails:
$ opa run bundle2.tar.gz
error: load error: 1 error occurred during loading: bundle bundle2.tar.gz: bundle load failed on /data.json: root value must be object
Checking the contents of data.json in bundle2.tar.gz reveals the following:
$ tar -O -xf bundle2.tar.gz /data.json
null
The expected outcome would be that data.json contained {} just like from the first bundle created.
Seems like an issue in the Merge method. In this case, where the values are nil, the resulting bundle's Data field won't be intialized and hence you get the error at runtime.
Although it is a bit of an edge case, I think it's meant to be supported using another bundle as the source when building a new bundle, adding e.g. another directory or policy to the second bundle. There seems to be a problem when merging two empty (i.e. containing
{}
)data.json
files though.Provided a directory structure like below:
$ tree -a . ├── bundle1 │ ├── .manifest │ └── p1.rego └── bundle2 ├── .manifest └── p2.rego 3 directories, 4 files
And we build a first bundle from the
bundle1
directory:Looking at the
data.json
file from the bundle, and as expected, we've been provided an empty object:Now, let's build a second bundle using the
bundle2
directory and the first bundle as input.The command works alright, but trying to run OPA with
bundle2.tar.gz
fails:Checking the contents of
data.json
inbundle2.tar.gz
reveals the following:The expected outcome would be that
data.json
contained{}
just like from the first bundle created.This was discovered when working on an example for @Ronnie-personal in https://github.com/orgs/open-policy-agent/discussions/352
The text was updated successfully, but these errors were encountered: