IBM-Security/ibmsecurity

Recent Update Breaks Configuration

Closed this issue · 5 comments

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: invalid syntax (entry.py, line 26)
failed: [someappliance] (item={u'stanza_id': u'aznapi-configuration', u'entries': [[u'logcfg', u'audit.authn:rsyslog server=syslog,port=23500,log_id=someappliance-somewrp-audit,flush_interval=20,max_event_len=0,rebind_retry=3,queue_size=0,hi_water=1,error_retry=2'], [u'logcfg', u'http.clf:rsyslog server=syslog,port=someport,log_id=someserver-somewrp-http,flush_interval=20,max_event_len=0,rebind_retry=3,queue_size=0,hi_water=1,error_retry=2']]}) => {"ansible_loop_var": "item", "changed": false, "item": {"entries": [["logcfg", "audit.authn:rsyslog server=syslog,port=someport,log_id=someserver-somewrp-audit,flush_interval=20,max_event_len=0,rebind_retry=3,queue_size=0,hi_water=1,error_retry=2"], ["logcfg", "http.clf:rsyslog server=syslog,port=23501,log_id=someserver-somewrp-http,flush_interval=20,max_event_len=0,rebind_retry=3,queue_size=0,hi_water=1,error_retry=2"]], "stanza_id": "aznapi-configuration"}, "module_stderr": "Traceback (most recent call last):\n File "/home/sygilber/.ansible/tmp/ansible-local-109197Usddiy/ansible-tmp-1645796276.28-109962-9449687838271/AnsiballZ_isam.py", line 102, in \n _ansiballz_main()\n File "/home/sygilber/.ansible/tmp/ansible-local-109197Usddiy/ansible-tmp-1645796276.28-109962-9449687838271/AnsiballZ_isam.py", line 94, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/home/sygilber/.ansible/tmp/ansible-local-109197Usddiy/ansible-tmp-1645796276.28-109962-9449687838271/AnsiballZ_isam.py", line 40, in invoke_module\n runpy.run_module(mod_name='ansible_collections.ibm.isam.plugins.modules.isam', init_globals=None, run_name='main', alter_sys=True)\n File "/usr/lib64/python2.7/runpy.py", line 176, in run_module\n fname, loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 82, in _run_module_code\n mod_name, mod_fname, mod_loader, pkg_name)\n File "/usr/lib64/python2.7/runpy.py", line 72, in _run_code\n exec code in run_globals\n File "/tmp/ansible_ibm.isam.isam_payload_eCGdmm/ansible_ibm.isam.isam_payload.zip/ansible_collections/ibm/isam/plugins/modules/isam.py", line 130, in \n File "/tmp/ansible_ibm.isam.isam_payload_eCGdmm/ansible_ibm.isam.isam_payload.zip/ansible_collections/ibm/isam/plugins/modules/isam.py", line 110, in main\n File "/tmp/ansible_ibm.isam.isam_payload_eCGdmm/ansible_ibm.isam.isam_payload.zip/ansible/module_utils/connection.py", line 190, in rpc\nansible.module_utils.connection.ConnectionError: invalid syntax (entry.py, line 26)\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ansible.module_utils.connection.ConnectionError: invalid syntax (entry.py, line 26)

Can someone please correct asap or rollback change ?

You're still using Python 2.7 ?

So this is Python 3.x syntax:

logger.debug(f"Get All {stanza_id}:\n {ret_obj}")

We are still on Python 2.7 for a while but moving to Python 3.x this year.
Still, please make sure to try keeping existing code work with Python V2.7 but consider new code yes target Python v3.x.

OK, so for now , you should install the previous version of ibmsecurity.
I'll remove the Python 3 code from entry.py - but it's been 2 years now since Python 2 went out of support, so I think it's high time to stop worrying about Python 2, to be honest.

pip install ibmsecurity==2022.2.23.0

OK - don't worry about the Python 3.x only code change introduced - We will handle it on our end.

But look for this item to fix which I do not think is a Python V2.7 vs V3.x issue.

We have this code pattern all over place where we can obtain legitimaly '[]' while reading from external properties files and the previous Python code would just accept it:

- { stanza_id: "acnt-mgt", entries: "[['some-entry','{{ lookup('ini', 'some-entry type=properties file={{ fact_rp_file }}') }}']]" }

I think we need to continue to support this pattern that keeps playbook clean without too much logic.