PaloAltoNetworks / ansible-pan

Ansible modules for Palo Alto Networks NGFWs
Other
229 stars 161 forks source link

Issue with Panos_query_rules ansible module #425

Closed techdoodle closed 4 years ago

techdoodle commented 5 years ago

Hi, I am facing the problem with panos_query_match rule module with the ip_address columns (source_ip and destination_ip). It's returning an existing rule when i give it 'devicegroup' and 'tag_name' and gives 'No rules matching the criteria' when i only give it Source_ip and destination_ip but when i give it all the details (source_ip, destination_ip, devicegroup and tag_name) it give us the following error:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ipaddress.AddressValueError: '10.8.0.4' does not appear to be an IPv4 or IPv6 address. Did you pass in a bytes (str in Python 2) instead of a unicode object? fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1567403920.25-170616163867029/AnsiballZ_panos_query_rules.py\", line 113, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1567403920.25-170616163867029/AnsiballZ_panos_query_rules.py\", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1567403920.25-170616163867029/AnsiballZ_panos_query_rules.py\", line 48, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/tmp/ansible_panos_query_rules_payload_eW8RW9/__main__.py\", line 510, in <module>\n File \"/tmp/ansible_panos_query_rules_payload_eW8RW9/__main__.py\", line 420, in main\n File \"/tmp/ansible_panos_query_rules_payload_eW8RW9/__main__.py\", line 211, in addr_in_obj\n File \"/usr/lib/python2.7/site-packages/ipaddress.py\", line 163, in ip_address\n ' a unicode object?' % address)\nipaddress.AddressValueError: '10.0.0.0' does not appear to be an IPv4 or IPv6 address. Did you pass in a bytes (str in Python 2) instead of a unicode object?\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Also attaching the code that we are using:

`roles:

Please reply ASAP.

shinmog commented 5 years ago

Seems this module breaks with python3, however this module is deprecated.