You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
zos_gather_facts does not get past the zoau version checker if the target host is on ZOAU v1.2.3 because of changes which were made to the output of zoaversion which were not caught and adjusted for in the ibm_zos_coremodule_utils/zoau_version_checker.py code. The logic in the get_zoau_version_str parses zoaversion output from the end (-1 index). Soon after the checker was written and released, the output of zoaversion was amended to include additional build info. This means the version checker has been silently failing since ZOAU v1.2.1 introduced additional build info (see below to compare output between v1.2.0 and other versions):
TASK [Collect z/OS facts on master_catalog.] ************************************************************************************************************************* An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: invalid literal for int() with base 10: 'H50145' fatal: [ec18]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 107, in <module>\n File \"<stdin>\", line 99, in _ansiballz_main\n File \"<stdin>\", line 47, in invoke_module\n File \"<frozen runpy>\", line 226, in run_module\n File \"<frozen runpy>\", line 98, in _run_module_code\n File \"<frozen runpy>\", line 88, in _run_code\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_gather_facts.py\", line 292, in <module>\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_gather_facts.py\", line 288, in main\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_gather_facts.py\", line 219, in run_module\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/zoau_version_checker.py\", line 35, in is_zoau_version_higher_than\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/zoau_version_checker.py\", line 35, in <listcomp>\nValueError: invalid literal for int() with base 10: 'H50145'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
In the python interpreter, with ZOAU v1.2.3 in the path:
# python3
Python 3.11.2 (heads/pyz_dev-3.11:806b16f89d, Mar 21 2023, 14:33:14) [Clang 14.0.0 ] on zos
Type "help", "copyright", "credits" or "license" for more information.
>>> import subprocess
>>> zoaversion_out = subprocess.run('zoaversion', shell=True, capture_output=True, check=False)
>>> cleaned_up=zoaversion_out.stdout.decode('UTF-8').strip().split(' ')
>>> cleaned_up
['2023/03/16', '18:17:00', 'CUT', 'V1.2.3', '1aa591fb', '2148', 'PH50145']
>>> version_list = cleaned_up[-1][1:].split('.')
>>> version_list
['H50145']
>>>
Note that the 'H' is the cause of zoau_version_checker failing because there's an implicit conversion to int at [line 35](system_version_list = [int(i) for i in system_version_list]) for the contents returned by the get_zoau_version_str which in this case is ['H50145'].
Ansible configuration.
No response
Contents of the inventory
No response
Contents of group_vars or host_vars
No response
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Are the dependencies a supported version?
IBM Z Open Automation Utilities
v1.2.3
IBM Enterprise Python
v3.11.x
IBM z/OS Ansible core Version
v1.5.0
ansible-version
latest
z/OS version
v2.4
Ansible module
zos_gather_facts
Bug description
zos_gather_facts
does not get past the zoau version checker if the target host is onZOAU v1.2.3
because of changes which were made to the output ofzoaversion
which were not caught and adjusted for in theibm_zos_core
module_utils/zoau_version_checker.py
code. The logic in theget_zoau_version_str
parseszoaversion
output from the end (-1 index). Soon after the checker was written and released, the output ofzoaversion
was amended to include additional build info. This means the version checker has been silently failing since ZOAUv1.2.1
introduced additional build info (see below to compare output between v1.2.0 and other versions):Zoaversion output for various ZOAU versions:
2021/07/07 22:36:30 CUT V1.2.0
2022/09/07 15:26:50 CUT V1.2.1 d2f6557 1880
2022/12/06 20:44:00 CUT V1.2.2 ee30137 2525
2023/03/16 18:17:00 CUT V1.2.3 1aa591fb 2148 PH50145
Code from
zoau_version_checker.py
'sget_zoau_version_str
function:link to problem line.
My proposal is to rewrite the code to grab the version info from the front of the array, index 3, rather than the end.
On a longer term, it is worth exploring if it is possible to leverage
zoautil_py
rather than calling and parsing command line utils.Playbook verbosity output.
Playbook calling
zos_gather_facts
with ZOAUv1.2.3
on target host:Yields output:
TASK [Collect z/OS facts on master_catalog.] ************************************************************************************************************************* An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ValueError: invalid literal for int() with base 10: 'H50145' fatal: [ec18]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"<stdin>\", line 107, in <module>\n File \"<stdin>\", line 99, in _ansiballz_main\n File \"<stdin>\", line 47, in invoke_module\n File \"<frozen runpy>\", line 226, in run_module\n File \"<frozen runpy>\", line 98, in _run_module_code\n File \"<frozen runpy>\", line 88, in _run_code\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_gather_facts.py\", line 292, in <module>\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_gather_facts.py\", line 288, in main\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_gather_facts.py\", line 219, in run_module\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/zoau_version_checker.py\", line 35, in is_zoau_version_higher_than\n File \"/tmp/ansible_zos_gather_facts_payload_mgcthlf5/ansible_zos_gather_facts_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/module_utils/zoau_version_checker.py\", line 35, in <listcomp>\nValueError: invalid literal for int() with base 10: 'H50145'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
In the python interpreter, with ZOAU
v1.2.3
in the path:Note that the 'H' is the cause of zoau_version_checker failing because there's an implicit conversion to int at [line 35](system_version_list = [int(i) for i in system_version_list]) for the contents returned by the
get_zoau_version_str
which in this case is ['H50145'].Ansible configuration.
No response
Contents of the inventory
No response
Contents of
group_vars
orhost_vars
No response
The text was updated successfully, but these errors were encountered: