configdep: T5839: remove trivially redundant config dependency calls #2659
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.
Change Summary
NOTE: this requires vyos/vyatta-cfg#74
NOTE: this should not be backported until it has had a bit of time in 1.5
Remove redundant calls to config dependencies in two steps:
(1) remove trivial redundancies produced by multiple calls to
set_dependents
within a given config-mode script(2) add a global list of dependencies under vyos-configd and execute in that context, when script is called with vyos-configd support
The case (1) is necessary as
set_dependents
can be called conditionally; a simple example, used below for demonstration, is that of firewall.py wherein dependents["system_conntrack", "nat", "policy_route"]
are added if 'group' is present (group-resync), and["system_conntrack"]
is added unconditionally.An important consideration is that adjusting the script logic to avoid redundancies is fragile and prone to error and NOT recommended, in favor of a proper solution, provided here.
The case (2) is necessary as otherwise, scripts process local dependency lists without knowledge of other script calls, for examples, firewall 'group-resync' will call
["system_conntrack", "nat", "policy_route"]
, which will incur nat.py calling["system_conntrack"]
subsequently. Again, one should not need to handle the logic of execution from with the logic of dependency.Example below:
Without any redundancy pruning:
--- including set_dependents calls:
--- limiting to the resulting script calls:
With intra-script dependency pruning:
--- including set_dependents calls
--- with result:
With global dependency list:
--- scripts set dependencies as before:
--- dependents are called under vyos-configd:
Types of changes
Related Task(s)
Related PR(s)
vyos/vyatta-cfg#74
Component(s) name
Proposed changes
How to test
Smoketest result
Checklist: