ibm_zos_core
ibm_zos_core copied to clipboard
[Bug] {zos_job_submit] TypeError: submit() takes from 1 to 2 positional arguments but 3 were given
Is there an existing issue for this?
- [X] There are no existing issues.
Bug description
Trying to use Python 3.12.1 on z/OS 2.5. Python 3.11.5 works.
IBM z/OS Ansible core Version
v1.9.0
IBM Z Open Automation Utilities
v1.2.5 (default)
IBM Enterprise Python
v3.12.x
ansible-version
v2.16.x (default)
z/OS version
v2.5 (default)
Ansible module
zos_job_submit
Playbook verbosity output.
bash-4.4$ ansible-playbook submit.yml
PLAY [MA1] *************************************************************************************************************************
TASK [Submit a job] ****************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: submit() takes from 1 to 2 positional arguments but 3 were given
fatal: [mvs-sysd]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File "
PLAY RECAP ************************************************************************************************************************* mvs-sysd : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
Ansible configuration.
bash-4.4$ ansible-config view
[defaults]
forks = 25
inventory = ~/playbooks/inventory.yml
host_key_checking = false
remote_port = 2222
timeout = 15
#deprecation_warnings=false
[ssh_connection]
pipelining = true
Contents of the inventory
#
# Hosts
#
MA1:
hosts:
mvs-sysd:
vars:
ansible_user: "@02858"
#
Contents of group_vars
or host_vars
#
ZOAU_HOME: /hewitt/zopentools/zoau1258
#ZOAU_HOME: /hewitt/zopentools/zoau1310
#PYZ_HOME: /hewitt/zopentools/python311/usr/lpp/IBM/cyp/v3r11/pyz
PYZ_HOME: /hewitt/zopentools/python312/usr/lpp/IBM/cyp/v3r12/pyz
ansible_python_interpreter: "{{PYZ_HOME}}/bin/python3"
environment_vars:
LIBPATH: "{{ZOAU_HOME}}/lib:{{PYZ_HOME}}/lib:/lib:/usr/lib:."
PATH: "{{ZOAU_HOME}}/bin:{{PYZ_HOME}}/bin:/bin:/usr/sbin:."
PYTHONSTDINENCODING: cp1047
# not compatible with pip installing the zoau package
# PYTHONPATH: "{{ZOAU_HOME}}/lib"
# works without it
# LANG: C
_BPXK_AUTOCVT: ON
_CEE_RUNOPTS: "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
_TAG_REDIR_IN: txt
_TAG_REDIR_OUT: txt
_TAG_REDIR_ERR: txt
#
I'm trying to see what's different here, because I haven't duplicated the error.
- bash-4.3# zoaversion
- 2024/03/26 01:50:41 CUT V1.2.5.8 366c83be 5264 PH60332 1165 82cc154c
- bash-4.3# python --version
- Python 3.12.1
- bash-4.3# submit test.jcl
- JOB JOB00164 submitted from path 'test.jcl'
- bash-4.3# pjdd JOB00164 EVENTLOG
- 1 STEP0001 IEBGENER 0 - -
I'll check source code on our side for clarity
zos_job_submit, line 699: job_submitted = jobs.submit(src, is_unix=is_unix, **kwargs)
I don't see anything version specific here, but it is passing potentially 3 arguments.
Right now, there are 2 possible issues that I can see:
- There could be a zoau 1.2.5.x issue with Python 3.12, since 3.11 works
- There could be a ansible-core issue with zoau < 1.3.1 issue in ansible, but that wouldn't explain why 3.11 works
- Just to be safe, I'll reach out to the customer to check on which ansible core version they are using.
update: looking at other recent tickets, he is stating Ansible core 1.9, so I'll pull a copy of that for a deeper duplication, and a check of the line number.
In 1.9.0 and 1,.9.1 source, the line I commented on above is exactly at 707. I'll check with zoau team to see if this rings a bell, because we are consistently passing 3 parameters.
Just to confirm: ansible [core 2.16.6] ibm.ibm_zos_core 1.9.0
The issue applies to z/OS 2.5 and 3.1
thanks
Trying the zos_data_set module:
TASK [Delete and define LDS] *************************************************************************** fatal: [mvs-sysd]: FAILED! => {"changed": false, "message": "", "msg": "TypeError("_create() missing 1 required positional argument: 'dataset_type'")", "names": ["@02858.LDS"]}
I'm seeing an issue in python 3.12 documentation (https://peps.python.org/pep-0692/), which means the way ibm_zos_core passes 'kwargs' might be at issue here. I'll run some tests in the next day or so to see if I can duplicate this and correct it.
Unfortunately, the current answer would be "this combination doesn't work with Python 3.12... use 3.11 until we understand what's going on better".
Ok thanks. My understanding is/was zoau 1.2.x.x worked with python 3.11.x and 3.12.x. And zoau1.3.x.x works with python 3.12.x but is waiting on ibm.ibm_zos_core 1.10.x
I believe there is a combination of zos _core1.9.x + zoau 1.2 and 3.12 that causes this. I should duplicate this tonight, but because of the 3.12 pep change, I think you will need to wait for 1.10, so you can use zoau 1.3.x, which doesn't have this issue.
I tried that exact combination: zoau 1.2.5 (tried .6 and .8), and got this on our official 1.9 test pipeline:
File : "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_1u359rpg/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 908, in run_module
File: "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_1u359rpg/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 694, in submit_src_jcl
TypeError: submit() takes from 1 to 2 positional arguments but 3 were given
.
This is a coflict betweem zoau and python 3.12: using 3.11, as you have seen, works okay.
I will relay this to the zoau team, to see if they have a work-around.
Will make a python recreate to make sure zoau can duplicate this.
@gngrossi : I'm getting odd responses using 1.2.4 versus 1.2.5.8, so I'm beginning to believe something was 'fixed' in 1.2.5.8, compared to earlier versions. This was done at the USS/console level. I'll try 2 other versions, then go to python duplication, but patching up to 1.2.5.8 may resolve this.
I am not able to duplicate that specific error message using 1.2.3, 1.2.4, 1.2.5.6, or 1.2.5.8 with python 3.12. I even ported our core code to isolate the call even further, but no luck. My first suggestion will be to re-install 1.2.5.8, in case something was damaged from switching between 1.3.x and 1.2.x
I note you have PYTHONPATH commented out in the environment... could you try this with that value set, as well? I'm not aware of any compatibility issue there, but I don't use pip installs... our zoau versions are on a read-only volume in the testing area.
I have now migrated to using zos_core:==1.10.0-beta.1, zoau 1.3.1.1 with python 3.12.1 on z/OS 3.1.
@gngrossi Following up: since you upgraded zos_core and zoau modules, are you satisfied so we can close this ticket?
Yes, closing. thanks