PaloAltoNetworks / ansible-pan

Ansible modules for Palo Alto Networks NGFWs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panos_tag_object fails to delete with unknown color

jvanderaa opened this issue · comments

Describe the bug

Setup

  • Create a tag on the Panorama GUI with Maroon (color19)
  • Run playbook to remove unwanted tags

Execution

  1. Gather tag objects from panos_object_facts module
  2. Determine which tags belong, which need to be deleted
  3. Attempt to delete using the state: absent on panos_tag_object module, errors out that:
value of color must be one of: red, green, blue, yellow, copper, orange, purple, gray, light green, cyan, light gray, blue gray, lime, black, gold, brown, got: color19

Expected behavior

I'd expect that the objects would get deleted

Current behavior

Ansible errors out due to expected color

Possible solution

If the state is absent, do not do a color check?

  • Attempted to run without the color key, and that errored as well:
MODULE_STDERR:

Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1589395215.5506418-2467-34486907132534/AnsiballZ_panos_tag_object.py", line 102, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1589395215.5506418-2467-34486907132534/AnsiballZ_panos_tag_object.py", line 94, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1589395215.5506418-2467-34486907132534/AnsiballZ_panos_tag_object.py", line 40, in invoke_module
    runpy.run_module(mod_name='ansible_collections.paloaltonetworks.panos.plugins.modules.panos_tag_object', init_globals=None, run_name='__main__', alter_sys=True)
  File "/usr/local/lib/python3.7/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/local/lib/python3.7/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/local/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_panos_tag_object_payload_phjvd2zb/ansible_panos_tag_object_payload.zip/ansible_collections/paloaltonetworks/panos/plugins/modules/panos_tag_object.py", line 148, in <module>
  File "/tmp/ansible_panos_tag_object_payload_phjvd2zb/ansible_panos_tag_object_payload.zip/ansible_collections/paloaltonetworks/panos/plugins/modules/panos_tag_object.py", line 125, in main
  File "/usr/local/lib/python3.7/site-packages/pandevice/objects.py", line 178, in color_code
    raise ValueError("Color '{0}' is not valid".format(color_name))
ValueError: Color 'None' is not valid

Steps to reproduce

  1. Gather tag objects from panos_object_facts module
  2. Determine which tags belong, which need to be deleted
  3. Attempt to delete using the state: absent on panos_tag_object module, errors out that:

Context

Trying to delete tags that should not be in the environment.

Your Environment

ansible 2.9.9

latest (2020-05-13) Galaxy instance of the collection, fresh install to Docker

🎉 Thanks for opening your first issue here! Welcome to the community!

Closing in favor of the modern repo.