Description
Follow-on to #271 (closed as solved by the driver registry). The accepted pattern for disabling a built-in post-load callback filters by function __name__:
rules.post_load_callbacks[:] = [
cb for cb in rules.post_load_callbacks
if cb.__name__ != "_remove_ipv4_acl_remarks"
]
This works (and is documented in the Administrator Guide), but matching a private function's name string is fragile: a rename silently turns the filter into a no-op.
Proposed change
Give built-in callbacks stable public identities — export them as documented names from their driver modules (they are already module-level functions), e.g.:
from hier_config.platforms.cisco_ios.driver import remove_ipv4_acl_remarks
rules.post_load_callbacks.remove(remove_ipv4_acl_remarks)
Filtering by object identity instead of name string. Scope is deliberately minimal: rename/export the callback functions and update the docs recipe. No remove_post_load_callback() helper — identity-based list operations on the existing mutable list are sufficient.
Context
Description
Follow-on to #271 (closed as solved by the driver registry). The accepted pattern for disabling a built-in post-load callback filters by function
__name__:This works (and is documented in the Administrator Guide), but matching a private function's name string is fragile: a rename silently turns the filter into a no-op.
Proposed change
Give built-in callbacks stable public identities — export them as documented names from their driver modules (they are already module-level functions), e.g.:
Filtering by object identity instead of name string. Scope is deliberately minimal: rename/export the callback functions and update the docs recipe. No
remove_post_load_callback()helper — identity-based list operations on the existing mutable list are sufficient.Context