pan-os-ansible icon indicating copy to clipboard operation
pan-os-ansible copied to clipboard

result["before"] includes newly added items for list type params

Open alperenkose opened this issue 6 months ago • 0 comments

Describe the bug

result["before"] includes newly added items when updating a list type param. Issue seen on panos_security_rule but possibly exists on others as well.

Consider the following scenario:

Existing security rule only have "192.168.8.0/24" in source_ip.

Following request is made to add additional address to the list of source_ip.

- name: "merged state update"
  paloaltonetworks.panos.panos_security_rule:
    provider: "{{ device }}"
    state: merged
    device_group: "lab1-ha-dg"
    rulebase: "post-rulebase"
    rule_name: "rule-with-defaults"
    source_ip: ["10.0.0.0/8"]
    source_zone: ["private"]

In result["before"] it looks like following, whereas it looks correct in result["diff"]["before"] with "192.168.8.0/24" only;

    "source_ip": [
        "192.168.8.0/24",
        "10.0.0.0/8"
    ],

Expected behavior

result["before"] should return existing configuration, not merged configuration for list type params.

Possible solution

It looks like we need a fix in describe() method to return with a deep-copied list as nested list in the object might be the issue..

alperenkose avatar Aug 08 '24 13:08 alperenkose