GithubHelp home page GithubHelp logo

Comments (6)

dstogsdill avatar dstogsdill commented on September 16, 2024

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.

            if not item.equal(virtual_router, compare_children=False):
                changed = True
                virtual_router.extend(item.children)

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.

from pan-os-ansible.

chancez avatar chancez commented on September 16, 2024

panos_log_forwarding_profile_match_list isn't idempotent either, yet it but it does use apply_state, so apply_state isn't perfect either.

from pan-os-ansible.

dstogsdill avatar dstogsdill commented on September 16, 2024

@chancez You are correct. the apply_state function mutates the object during iteration so any module calling this function will pretty much always register a change. Additionally, the function does not account for any objects with interfaces so these objects will also register a change if not accounted for before calling the function.

from pan-os-ansible.

dstogsdill avatar dstogsdill commented on September 16, 2024

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.

from pan-os-ansible.

mrichardson03 avatar mrichardson03 commented on September 16, 2024

The problem with idempotence here is the child objects attached to the virtual router. panos_virtual_router should really write all child objects itself, rather than only doing part of the configuration and then having multiple other modules then modify that VR. One way to do this would be to move all the BGP configuration into panos_virtual_router, which would make some sense because BGP configuration can't exist outside of a VR.

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.

from pan-os-ansible.

shinmog avatar shinmog commented on September 16, 2024

Another idempotency fix was added, this should be resolved now in the next release.

from pan-os-ansible.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.