Skip to content

Stable public identities for built-in post-load callbacks #286

Description

@jtdub

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions