-
Notifications
You must be signed in to change notification settings - Fork 124
Issue #974 Interface Enable State Idempotency #987
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Issue #974 Interface Enable State Idempotency #987
Conversation
no_cmd = True if self.defaults.get("default_mode") == "layer3" else False | ||
self.addcmd(have, "mode", no_cmd) | ||
|
||
# Handle the 'enabled' state separately |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moves the resolution of the state to after the interface mode, so that we can feed the final have_mode
into the enabled state resolution.
"interface port-channel4", | ||
"no shutdown", | ||
] | ||
result = self.execute_module(changed=True, device="legacy") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually appears to be ineffective. The parent class does not process the "device" arg at all from what I can see. Or load any fixtures one way or another
v10.2.0 removed the use of `module_utils.network.nxos.nxos.default_intf_enabled()` to determine the targets default state of various interface types. This change re-instates that behaviour, to resolve idempotency issues. Tests are adjusted to suit.
59757c0
to
d4ff3d1
Compare
"result": { | ||
'{{ name }}': { | ||
'enabled': "{{ False if shutdown is defined and negate is not defined else True }}", | ||
'enabled': "{{ True if negate is defined and shutdown is defined else False if shutdown is defined else None }}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dont assume at this point that the absence of (no)? shutdown
implies either enabled or disabled.
This change means we only set enabled True|False if it is explicit in the show run
output, other wise its None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the logic that resolves facts should handle the system default shutdown logic such that the facts are complete. But that's not the previous convention.
SUMMARY
v10.2.0 removed the use of
module_utils.network.nxos.nxos.default_intf_enabled()
to determine the targets default state of various interface types.This change re-instates that behaviour, to resolve idempotency issues. Tests are adjusted to suit.
Fixes #974
ISSUE TYPE
COMPONENT NAME
Module: interfaces