Description
Currently HConfig._is_duplicate_child_allowed() returns False unconditionally (root.py:211-213). This means configs with repeated top-level sections (e.g., multiple ip prefix-list entries with the same name, FortiOS config blocks) either raise DuplicateChildError or silently merge.
Proposed Change
Make root-level duplicate handling driver-configurable, the same way ParentAllowsDuplicateChildRule works for HConfigChild. Either:
- Add a
root_allows_duplicate_child rule list to HConfigDriverRules
- Or unify the mechanism so
ParentAllowsDuplicateChildRule applies at root level too (with a root-matching sentinel in match_rules)
Breaking Change
Yes — changes the root HConfig class behavior and may affect downstream code that relies on the current deduplication.
Description
Currently
HConfig._is_duplicate_child_allowed()returnsFalseunconditionally (root.py:211-213). This means configs with repeated top-level sections (e.g., multipleip prefix-listentries with the same name, FortiOSconfigblocks) either raiseDuplicateChildErroror silently merge.Proposed Change
Make root-level duplicate handling driver-configurable, the same way
ParentAllowsDuplicateChildRuleworks forHConfigChild. Either:root_allows_duplicate_childrule list toHConfigDriverRulesParentAllowsDuplicateChildRuleapplies at root level too (with a root-matching sentinel inmatch_rules)Breaking Change
Yes — changes the root
HConfigclass behavior and may affect downstream code that relies on the current deduplication.