cisco.asa
cisco.asa copied to clipboard
Can't parse object groups if interface has a descrption
SUMMARY
cisco.asa.asa_ogs
fails to parse a Cisco ASA config if an interface has a description.
ISSUE TYPE
- Bug Report
COMPONENT NAME
cisco.asa.asa_ogs
ANSIBLE VERSION
⇨ ansible --version
ansible [core 2.14.4]
config file = None
configured module search path = ['/home/nleiva/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/nleiva/.local/lib/python3.11/site-packages/ansible
ansible collection location = /home/nleiva/.ansible/collections:/usr/share/ansible/collections
executable location = /home/nleiva/.local/bin/ansible
python version = 3.11.3 (main, May 24 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)] (/usr/bin/python3)
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
cisco.asa 4.0.0
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
Provide the following config file:
interface Ethernet1/1
description SOMETHING
!
object-group network TEST-NETWORK
network-object host 100.64.0.1
network-object host 192.168.0.1
object-group service TEST-SERVICE
service-object tcp destination eq ftp
service-object tcp destination eq ftp-data
service-object object NAME
Use cisco.asa.asa_ogs
to parse the config.
- name: Test Cisco ASA modules
hosts: localhost
gather_facts: false
tasks:
- name: Parse object groups for provided configuration
cisco.asa.asa_ogs:
running_config: "{{ lookup('file', config) }}"
state: parsed
ignore_errors: true
register: asa_ogs
vars:
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: cisco.asa.asa
EXPECTED RESULTS
If you changed the interface portion to something like:
interface Ethernet1/1
shutdown
no nameif
no security-level
no ip address
!
It parses the info without issues.
ACTUAL RESULTS
Can't parse the file. Message: "'obj_type' is undefined"
TASK [Parse object groups for provided configuration] *******************************************************************************************************************************************************
task path: /home/nleiva/projects/ansible-cisco-asa/main.yml:14
redirecting (type: action) cisco.asa.asa_ogs to cisco.asa.asa
redirecting (type: action) cisco.asa.asa_ogs to cisco.asa.asa
The full traceback is:
File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/facts/facts.py", line 135, in get_network_resources_facts
inst.populate_facts(
File "/usr/share/ansible/collections/ansible_collections/cisco/asa/plugins/module_utils/network/asa/facts/ogs/ogs.py", line 54, in populate_facts
current = rmmod.parse()
File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/rm_base/network_template.py", line 88, in parse
res = self._deepformat(deepcopy(parser["result"]), vals)
File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/rm_base/network_template.py", line 64, in _deepformat
wtmplt[ftkey] = self._deepformat(tval, data)
File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/rm_base/network_template.py", line 60, in _deepformat
ftkey = self._template(tkey, data)
File "/usr/share/ansible/collections/ansible_collections/ansible/netcommon/plugins/module_utils/network/common/utils.py", line 721, in __call__
value = self.env.from_string(value).render(variables)
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render
self.environment.handle_exception()
File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File "<template>", line 1, in top-level template code
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"config": null,
"running_config": "\r\ninterface Ethernet1/1\r\n description SOMETHING\r\n!\r\nobject-group network TEST-NETWORK\r\n network-object host 100.64.0.1\r\n network-object host 192.168.0.1\r\nobject-group service TEST-SERVICE\r\n service-object tcp destination eq ftp \r\n service-object tcp destination eq ftp-data \r\n service-object object NAME",
"state": "parsed"
}
},
"msg": "'obj_type' is undefined"
}
...ignoring