mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
0c8463e09b
This commit does a few things: * Extend the low-level file loader and callers to ensure ModuleFile objects have a URL field. This means we can tell if two ModuleFile objects refer to the same source file. Previously we had to keep track of bundle names to do this. This commit does not touch the bundle activation logic which does this already--we can revisit that in the future. * Update the bundle writer to use the URL field by default. This allows us to write merged bundles correctly. * Add a merge function that will be used by the new build command to combine multiple bundles. * Add a helper function for checking if roots contain a path. In the process refactor the overlap helper to use the same logic. Also add a helper function to ensure roots exist in the bundle manifest. * Add a deepcopy function for bundles. This is useful if mutating bundles and there is a need to revert. * Format bundle contents on write by default. Callers of the old Write function will not be affected (it disables formatting.) * Format the overlap error to quote roots in case they are empty. Signed-off-by: Torin Sandall <torinsandall@gmail.com>