feat: preserve tags for negated lines in config_to_get_to #126
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.
Summary
This PR introduces the ability to selectively generate snippets of remediation configuration based on tags
Changes
The only significant change is that when negating a line in the remediation configuration (
_config_to_get_to_left
), we preserve the tags that were previously set on the now-negatedHConfigChild
.Example
Consider the case where we want to selectively remediate only parts of a configuration, we have two options:
remediation_config_filtered_text
)Option (1) can fail in the following example scenario:
192.0.2.1
our_neighbor
tagThis happens because the generated configuration is completely empty once it is filtered: it does not contain this neighbor, hence it does not contain anything!
The right (?) approach is therefore to compute the remediation configuration and only filter it afterwards, which requires that we are able to tag it properly.
remediation_config_filtered_text
will re-run tagging on the remediation configuration, but this implies that our tags must also match remediation configurations (with its negations and other necessary artifacts). I believe that copying the tags to the remediation configuration when negating lines actually makes more sense.Notes