Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [zos_job_submit] failed with wait_time_s parameter set to 0 #670

Closed
vcorfmatibm opened this issue Mar 15, 2023 · 4 comments
Closed
Assignees
Labels
Bug Something isn't working as designed. In Progress This issue is under review by a team member.

Comments

@vcorfmatibm
Copy link

Bug description

When using zos_job_submit with wait_time_s set to 0 with version 1.5.0-beta.1 of Ansible z/OS core collection, it fails with following error.
Moreover, doc is not clear about this (wait and wait_time_s parameters)

Log :
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' 9.30.222.103 '/bin/sh -c '"'"'echo ~vcorfma && sleep 0'"'"''
<9.30.222.103> (0, b'/u/vcorfma\n', b'')
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' 9.30.222.103 '/bin/sh -c '"'"'( umask 77 && mkdir -p "echo /u/vcorfma/.ansible/tmp"&& mkdir "echo /u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330" && echo ansible-tmp-1678889268.7941587-185-236712486247330="echo /u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330" ) && sleep 0'"'"''
<9.30.222.103> (0, b'ansible-tmp-1678889268.7941587-185-236712486247330=/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330\n', b'')
Using module file /home/vcorfmat/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py
<9.30.222.103> PUT /home/vcorfmat/.ansible/tmp/ansible-local-57vk13c29_/tmp1u4w_hsb TO /u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py
<9.30.222.103> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' '[9.30.222.103]'
<9.30.222.103> (0, b'sftp> put /home/vcorfmat/.ansible/tmp/ansible-local-57vk13c29_/tmp1u4w_hsb /u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py\n', b'')
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' 9.30.222.103 '/bin/sh -c '"'"'chmod u+x /u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/ /u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py && sleep 0'"'"''
<9.30.222.103> (0, b'', b'')
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' -tt 9.30.222.103 '/bin/sh -c '"'"'_BPXK_AUTOCVT=ON ZOAU_HOME=/var/usr/lpp/IBM/zoautil LIBPATH=/var/usr/lpp/IBM/zoautil/lib:/var/usr/lpp/IBM/cyp/v3r10/pyz/lib:/lib:/usr/lib:. PATH=/var/usr/lpp/IBM/zoautil/bin:/var/usr/lpp/IBM/cyp/v3r10/pyz/bin:/bin:/var/bin _CEE_RUNOPTS='"'"'"'"'"'"'"'"'FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'"'"'"'"'"'"'"'"' _TAG_REDIR_ERR=txt _TAG_REDIR_IN=txt _TAG_REDIR_OUT=txt LANG=C /var/usr/lpp/IBM/cyp/v3r10/pyz/bin/python3 /u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py && sleep 0'"'"''
<9.30.222.103> (1, b'Traceback (most recent call last):\r\n File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 100, in \r\n _ansiballz_main()\r\n File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 92, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 40, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_job_submit', init_globals=dict(_module_fqn='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_job_submit', _modlib_path=modlib_path),\r\n File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 224, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 96, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 86, in _run_code\r\n exec(code, run_globals)\r\n File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 968, in \r\n File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 964, in main\r\n File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 797, in run_module\r\nTypeError: can only concatenate str (not "int") to str\r\n', b'Shared connection to 9.30.222.103 closed.\r\n')
<9.30.222.103> Failed to connect to the host via ssh: Shared connection to 9.30.222.103 closed.
<9.30.222.103> ESTABLISH SSH CONNECTION FOR USER: vcorfma
<9.30.222.103> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o Port=222 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="vcorfma"' -o ConnectTimeout=10 -o 'ControlPath="/home/vcorfmat/.ansible/cp/70a06198bc"' 9.30.222.103 '/bin/sh -c '"'"'rm -f -r /u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/ > /dev/null 2>&1 && sleep 0'"'"''
<9.30.222.103> (0, b'', b'')
The full traceback is:
Traceback (most recent call last):
File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 100, in
_ansiballz_main()
File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 92, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 40, in invoke_module
runpy.run_module(mod_name='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_job_submit', init_globals=dict(_module_fqn='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_job_submit', _modlib_path=modlib_path),
File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 224, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 96, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 968, in
File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 964, in main
File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 797, in run_module
TypeError: can only concatenate str (not "int") to str
fatal: [zos_host_01]: FAILED! => {
"changed": false,
"failed_when_result": true,
"module_stderr": "Shared connection to 9.30.222.103 closed.\r\n",
"module_stdout": "Traceback (most recent call last):\r\n File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 100, in \r\n _ansiballz_main()\r\n File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 92, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/u/vcorfma/.ansible/tmp/ansible-tmp-1678889268.7941587-185-236712486247330/AnsiballZ_zos_job_submit.py", line 40, in invoke_module\r\n runpy.run_module(mod_name='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_job_submit', init_globals=dict(_module_fqn='ansible_collections.ibm.ibm_zos_core.plugins.modules.zos_job_submit', _modlib_path=modlib_path),\r\n File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 224, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 96, in _run_module_code\r\n _run_code(code, mod_globals, init_globals,\r\n File "/var/usr/lpp/IBM/cyp/v3r10/pyz/lib/python3.10/runpy.py", line 86, in _run_code\r\n exec(code, run_globals)\r\n File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 968, in \r\n File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 964, in main\r\n File "/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_qlari1be/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py", line 797, in run_module\r\nTypeError: can only concatenate str (not "int") to str\r\n",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}

Playbook verbosity output

No response

Contents of ansible.cfg

#*******************************************************************************
# Licensed Materials - Property of IBM
# (c) Copyright IBM Corp. 2022. All Rights Reserved.
#
# Note to U.S. Government Users Restricted Rights:
# Use, duplication or disclosure restricted by GSA ADP Schedule
# Contract with IBM Corp.
#*******************************************************************************
[defaults]
forks = 25
host_key_checking = False
#callbacks_enabled = timer, profile_tasks, profile_roles
stdout_callback = ibm.ibm_zos_plum_deploy.cb_evidences

[ssh_connection]
pipelining = True
#ssh_args = -o ControlMaster=auto -o ControlPersist=3600s -o PreferredAuthentications=publickey

[callback_evidences]
evidences_folder = ../evidences

Contents of the inventory

all:
  hosts:
    cvb1:
      ansible_host: X.X.X.X
      ansible_user: MYUSER
      ansible_ssh_port: 222

Contents of group_vars or host_vars

environment_vars:
  _BPXK_AUTOCVT: "ON"
  ZOAU_HOME: "{{ ZOAU }}"
  #PYTHONPATH: "{{ ZOAU }}/lib"
  LIBPATH: "{{ ZOAU }}/lib:{{ PYZ }}/lib:/lib:/usr/lib:."
  PATH: "{{ ZOAU }}/bin:{{ PYZ }}/bin:/bin:/var/bin"
  _CEE_RUNOPTS: "FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
  _TAG_REDIR_ERR: "txt"
  _TAG_REDIR_IN: "txt"
  _TAG_REDIR_OUT: "txt"
  LANG: "C"

Ansible version

ansible [core 2.11.12]
  config file = /home/vcorfmat/ansible.cfg
  configured module search path = ['/home/vcorfmat/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible
  ansible collection location = /home/vcorfmat/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  jinja version = 2.10.1
  libyaml = True

IBM z/OS Ansible core Version

v1.5.0-beta.1

IBM ZOAU version

v1.1.1

z/OS version

2.4

Ansible module

zos_job_submit

@vcorfmatibm vcorfmatibm added the Bug Something isn't working as designed. label Mar 15, 2023
@ddimatos
Copy link
Collaborator

ddimatos commented Mar 22, 2023

  1. Fix the issue where the integer is concatenated to a string (when wait_time_s is <= 0)
  2. Clarify what the actual wait time is, its the complete module execution not solely the job execution time (eg JES time)
  3. Clarify wait - I don't think we need to its states its deprecated in 1.5 "Setting this option will yield no change, it is deprecated."
  4. Some general review and further testing (though we have several tests on this , long ans short run tests) they might be impacted by this but possibly a negative test should be added as well.

@ddimatos ddimatos changed the title [Bug] <zos_job_submit failed with wait_time_s parameter set to 0> [Bug] [zos_job_submit] failed with wait_time_s parameter set to 0> Mar 22, 2023
@ddimatos
Copy link
Collaborator

@vcorfmatibm - thank you for the issue, I did add some comments off the top of my head, will have this in for 1.5 GA in a few weeks.

@ddimatos
Copy link
Collaborator

ddimatos commented Mar 23, 2023

(1) Note the fields such as owner, checksum, gid come from the transfer of jcl from the controller to the managed node. In the future we can consider changing the transfer model to avoid compound module calls to file and copy.

Task

    - name: Submit {{job_name_2}}
      zos_job_submit:
        src: "{{ playbook_dir }}/{{job_name_2}}"
        location: LOCAL
        wait_time_s: 0
        max_rc: 300
      register: result

Result:

{
   "changed":false,
   "checksum":"bdaeea6f2f4b41c8ae30851fc0e55790eb7a5a9b",
   "dest":"/tmp/ansible.wldwaeg7",
   "gid":1,
   "group":"OMVSGRP",
   "md5sum":"c5a61b67de72c902e5eb1ced4f11d7b6",
   "mode":"0600",
   "msg":"The value for option wait_time_s is not valid, it must be greater than 0 and less than 86400.",
   "owner":"OBAGAOI",
   "size":374,
   "src":"/.ansible/tmp/ansible-tmp-1679538921.270772-49194-59116972935970/source",
   "state":"file",
   "uid":0
}

@ddimatos
Copy link
Collaborator

ddimatos commented Mar 23, 2023

(2) & (3) Updated the documentation for wait even though it was stated as deprecated and wait_time_s

  wait:
    required: false
    default: false
    type: bool
    description:
      - Setting this option will yield no change, it is deprecated. There is no
        no need to set I(wait); setting I(wait_times_s) is the correct way to
        configure the amount of tme to wait for a job to execute.
      - Configuring wait used by the L(zos_job_submit,./zos_job_submit.html) module has been
        deprecated and will be removed in ibm.ibm_zos_core collection.
      - See option I(wait_time_s).
  wait_time_s:
    required: false
    default: 10
    type: int
    description:
      - Option I(wait_time_s) is the total time that module
        L(zos_job_submit,./zos_job_submit.html) will wait for a submitted job
        to complete. The time begins when the module is executed on the managed
        node.
      - I(wait_time_s) is measured in seconds and must be a value greater than 0
        and less than 86400.

@ddimatos ddimatos moved this from 📗In plan to 🔍 Validation in IBM Ansible z/OS Core Collection Mar 23, 2023
@ddimatos ddimatos added the In Progress This issue is under review by a team member. label Mar 23, 2023
@ddimatos ddimatos changed the title [Bug] [zos_job_submit] failed with wait_time_s parameter set to 0> [Bug] [zos_job_submit] failed with wait_time_s parameter set to 0> Mar 23, 2023
@ddimatos ddimatos changed the title [Bug] [zos_job_submit] failed with wait_time_s parameter set to 0> [Bug] [zos_job_submit] failed with wait_time_s parameter set to 0 Mar 23, 2023
@ddimatos ddimatos added this to the [Q1] [2023] Bugs milestone Mar 26, 2023
@ddimatos ddimatos moved this from 🔍 Validation to ✅ Done in IBM Ansible z/OS Core Collection Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working as designed. In Progress This issue is under review by a team member.
Projects
Development

No branches or pull requests

3 participants