Repository navigation
fix(import): handle bindings that already exist on re-import - #213
Merged
Merged
Conversation
Importing a bundle a second time failed on every PolicyBinding document with a duplicate key error on (policy_id, group_id): only policies were compared with existing ones, bindings were always inserted. The dry run had the same blind spot and reported "would create". Existing bindings are now matched by policy and node group and follow the conflict mode: - new-version: set the priority from the file when it differs, report "updated"; report "skipped" when it is already the same. The enabled or disabled state is never changed. - skip: report "skipped". - error: fail during validation, so nothing is written. The dry run reports the same outcome as the import. This works for bindings that reference the policy by in-file name and by display name on the server. Also: - reject a bundle that binds the same policy to the same node group twice, which hit the same constraint - updating a binding through import needs binding:toggle on the group, like the bindings API - resync the group when the priority of an enabled binding changes - describe the binding behaviour in the user guide Fixes #209 Signed-off-by: Blagovest Petrov <blagovest@petrovs.info>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Importing a bundle a second time failed on every PolicyBinding document with a duplicate key error on (policy_id, group_id): only policies were compared with existing ones, bindings were always inserted. The dry run had the same blind spot and reported "would create".
Existing bindings are now matched by policy and node group and follow the conflict mode:
The dry run reports the same outcome as the import. This works for bindings that reference the policy by in-file name and by display name on the server.
Also:
Fixes #209