This PR introduces the ability to filter the unified diffs by configuration tags. It may be preferable to first read https://github.com/netdevops/hier_config/pull/126 in order to have a better understanding of this PR.
Changes
The unified_diff method on HConfigBase now accepts include_tags and exclude_tags arguments under the name unified_diff_with_tags. The unified_diff keeps the same behavior as a partial over unified_diff_with_tags.
This change allows the generated unified diff to selectively display only some tagged snippets of configuration, as opposed to the whole file
Example
See https://github.com/netdevops/hier_config/pull/126: the example there is analogous to what could be written here. Option (1) as described there would lead to the following unified diff (white space modified for better syntax highlighting):
- router bgp 65535
- neighbor 192.0.2.1
- ...
Which erroneously display that the router bgp 65535 is to be removed.
This PR implements a similar mechanism of filtering by tags, which allows to instead properly generate the right diff:
Summary
This PR introduces the ability to filter the unified diffs by configuration tags. It may be preferable to first read https://github.com/netdevops/hier_config/pull/126 in order to have a better understanding of this PR.
Changes
The
unified_diff
method onHConfigBase
now acceptsinclude_tags
andexclude_tags
arguments under the nameunified_diff_with_tags
. Theunified_diff
keeps the same behavior as a partial overunified_diff_with_tags
.This change allows the generated unified diff to selectively display only some tagged snippets of configuration, as opposed to the whole file
Example
See https://github.com/netdevops/hier_config/pull/126: the example there is analogous to what could be written here. Option (1) as described there would lead to the following unified diff (white space modified for better syntax highlighting):
Which erroneously display that the
router bgp 65535
is to be removed.This PR implements a similar mechanism of filtering by tags, which allows to instead properly generate the right diff: