-
Notifications
You must be signed in to change notification settings - Fork 98
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
not all modules are idempotent #4
Comments
I'm seeing this behavior too, however, it looks like this module doesn't use the 'apply_state' function as suggested. Rather it's relying on the pan object 'equal' function from the the base.py pan-os-python package.
This looks to be doing a straight string comparison of the XML representation of the objects. unfortunately if there is a change to the device configuration outside of this module (say assigning a virtual router to an interface using panos_l3_subinterface) then this will ALWAYS incorrectly detect a change. edit #1: Additionally the VirtualRouter object has an 'Interface' var that needs to be accounted for otherwise the assigned interfaces get removed upon applying the change. Right now the module only extends for the 'children' var to replicate any existing configurations. edit #2: I just realized this issue refers to several BPG modules and not the panos_virtual_router module which my comment refers to. I'll open a new new issue to apply a bug fix for the panos_virtual_router module I'm working on a fix for this but unsure how to assign this issue/bug to myself. |
|
@chancez You are correct. the |
There is another specific issue with the panos_bgp_peer module in addition to the underlying apply_state function. the PANOS xml api sets defaults to specific fields (i.e. keep-alive-interval and min-route-adv-interval). If these fields are omitted from your playbook the module will continue to detect a change. You can work around this by explicitly setting all fields in this module. I believe the permanent fix would be for the module to assign default values to these fields. |
The problem with idempotence here is the child objects attached to the virtual router. Another way to do this (and a lot of other modules) better in my opinion, is to have an idempotent way to manipulate the XML config. I have code that does this, and I opened #219 to show how it works and can be used. |
Another idempotency fix was added, this should be resolved now in the next release. |
Not all of the modules are idempotent. E.g. when I enable bgp with
panos_bgp
, then configure a peer group withpanos_bgp_peer_group
, and then add a bunch of peers withpanos_bgp_peer
, and then run the same playbook again, thepanos_bgp
task will remove the peers and peer_group, resulting in achanged
state instead ofok
Expected behavior
Run a playbook with these tasks twice:
The second run each task should display
ok
Current behavior
When run a second time, all tasks display
changed
Possible solution
I believe the source of the problem is in
module_utils/network/panos/panos.py
apply_state
function. In there the generated object only includes child types that exist in the new version of the object instead of leaving the existing children untouched.Your Environment
The text was updated successfully, but these errors were encountered: