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] Submitted local invalid JCL and returned with a stack trace #623

Closed
ddimatos opened this issue Jan 28, 2023 · 3 comments
Assignees
Labels
Bug Something isn't working as designed. In Progress This issue is under review by a team member.

Comments

@ddimatos
Copy link
Collaborator

ddimatos commented Jan 28, 2023

Bug description

I was submitting some invalid JCL located on the controller (on purpose), it seems to have timed out but I would not have known that unless I enabled -vvv verbosity in Ansible. The BAD JCL has no Job card and no such program on the zVM called IGYWCLG but the bad JCL is not the point, the issue is the response was not a message but a stack trace.

If you add a job card to the invalid JCL, the message is better:

fatal: [zvm]: FAILED! => {"changed": false, "checksum": "2b97a5a5c9d6855b76d9947ce91cb54f478248fa", "dest": "/tmp/ansible.te66xt_z", "duration": 0, "gid": 1, "group": "OMVSGRP", "md5sum": "aca644cfe5a5445f4a8cf99308b624e5", "mode": "0600", "msg": "The JCL submitted with job id JOB00378 but there was an error, please review the error for further details: The job completion code (CC) was not in the job log. Please review the error JCL ERROR  866 and the job log..", "owner": "BPXROOT", "size": 188, "src": "/.ansible/tmp/ansible-tmp-1674885410.488168-52125-39444954096433/source", "state": "file", "stderr": "The job completion code (CC) was not in the job log. Please review the error JCL ERROR  866 and the job log.", "stderr_lines": ["The job completion code (CC) was not in the job log. Please review the error JCL ERROR  866 and the job log."], "uid": 0}

Playbook:

---
- hosts: zvm
  collections:
    - ibm.ibm_zos_core
  gather_facts: false
  # vars:
  #   PYZ: "{{ hostvars.zvm.pyz }}"
  #   ZOAU: "{{ hostvars.zvm.zoau }}"

  environment: "{{ environment_vars }}"

  tasks:
    - name: Compile and Link
      zos_job_submit:
        src: "{{playbook_dir}}/files/COMPLINKjcl"
        location: LOCAL
        wait: false
        encoding:
          from: ISO8859-1
          to: IBM-1047
      register: job_sub_result

    - name: Result for job 
      debug:
        msg: "{{ job_sub_result }}"

Actual error without verbosity:

(ansible-doc) ddimatos:[ ~/git/github/playbooks ]ansible-playbook -i inventory zos_loadlib_module.yml

PLAY [zvm] ****************************************************************************************************************************************

TASK [Compile and Link] ***************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: list index out of range
fatal: [zvm]: FAILED! => {"changed": true, "checksum": "882f111fd42a1ced61df351cf4c976384880c5f6", "dest": "/tmp/ansible.jajjkx3l", "gid": 1, "group": "OMVSGRP", "md5sum": "6dec97e466b9ff254983f639c559c55d", "mode": "0600", "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 100, in <module>\n  File \"<stdin>\", line 92, in _ansiballz_main\n  File \"<stdin>\", line 40, in invoke_module\n  File \"/python2/usr/lpp/IBM/cyp/v3r9/pyz/lib/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/python2/usr/lpp/IBM/cyp/v3r9/pyz/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/python2/usr/lpp/IBM/cyp/v3r9/pyz/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_8dup1uu6/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 <module>\n  File \"/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_8dup1uu6/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\n  File \"/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_8dup1uu6/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py\", line 825, in run_module\n  File \"/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_8dup1uu6/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py\", line 648, in submit_src_jcl\nIndexError: list index out of range\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "owner": "BPXROOT", "rc": 1, "size": 88, "src": "/.ansible/tmp/ansible-tmp-1674884272.196486-50748-73492851718556/source", "state": "file", "uid": 0}

JCL:

//CLGP JOB
//CLG EXEC IGYWCLG
//COBOL.SYSIN DD DSN=IBMUSER.ANSIBLE.COBOL(HELLO),DISP=SHR

You might want the rest of the playbook to create the content:

---
- hosts: zvm
  collections:
    - ibm.ibm_zos_core
  gather_facts: false
  # vars:
  #   PYZ: "{{ hostvars.zvm.pyz }}"
  #   ZOAU: "{{ hostvars.zvm.zoau }}"

  environment: "{{ environment_vars }}"

  tasks:
    - name: Create a PDS data set if it does not exist
      zos_data_set:
        name: IBMUSER.ANSIBLE.COBOL
        type: pds
        space_primary: 5
        space_type: M
        record_format: fb
        record_length: 80
        block_size: 4000
      register: result

    - name: Result
      debug:
         msg: "{{result}}"

    - name: Create a MEMBER
      zos_data_set:
        name: IBMUSER.ANSIBLE.COBOL(HELLO)
        state: present
        replace: true
        type: MEMBER
      register: result

    - name: Result
      debug:
         msg: "{{result}}"

    - name: Inline some COBOL to the PDS Member
      zos_copy:
        content: |4
                   IDENTIFICATION DIVISION.
                   PROGRAM-ID. HELLOWRD.

                        PROCEDURE DIVISION.
                        DISPLAY "SIMPLE HELLO WORLD".
                        STOP RUN.
        dest: IBMUSER.ANSIBLE.COBOL(HELLO)
        force: yes

Playbook verbosity output


(ansible-doc) ddimatos:[ ~/git/github/playbooks ]ansible-playbook -i inventory zos_loadlib_module.yml -vvv
ansible-playbook [core 2.11.12]
  config file = /Users/ddimatos/git/github/playbooks/ansible.cfg
  configured module search path = ['/Users/ddimatos/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/modules']
  ansible python module location = /Users/ddimatos/ansible_versions/3_8_13/ansible-doc/lib/python3.8/site-packages/ansible
  ansible collection location = /Users/ddimatos/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/ddimatos/ansible_versions/3_8_13/ansible-doc/bin/ansible-playbook
  python version = 3.8.13 (default, Jun 14 2022, 23:29:22) [Clang 13.0.0 (clang-1300.0.27.3)]
  jinja version = 3.1.2
  libyaml = True
Using /Users/ddimatos/git/github/playbooks/ansible.cfg as config file
host_list declined parsing /Users/ddimatos/git/github/playbooks/inventory as it did not pass its verify_file() method
script declined parsing /Users/ddimatos/git/github/playbooks/inventory as it did not pass its verify_file() method
auto declined parsing /Users/ddimatos/git/github/playbooks/inventory as it did not pass its verify_file() method
Parsed /Users/ddimatos/git/github/playbooks/inventory inventory source with yaml plugin
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: zos_loadlib_module.yml ******************************************************************************************************************
1 plays in zos_loadlib_module.yml

PLAY [zvm] ****************************************************************************************************************************************
META: ran handlers

TASK [Compile and Link] ***************************************************************************************************************************
task path: /Users/ddimatos/git/github/playbooks/zos_loadlib_module.yml:52
Using module file /Users/ddimatos/ansible_versions/3_8_13/ansible-doc/lib/python3.8/site-packages/ansible/modules/tempfile.py
Pipelining is enabled.
<ec33017a.vmec.svl.ibm.com> ESTABLISH SSH CONNECTION FOR USER: omvsadm
<ec33017a.vmec.svl.ibm.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' ec33017a.vmec.svl.ibm.com '/bin/sh -c '"'"'_BPXK_AUTOCVT=ON ZOAU_HOME=/zoau/v1.0.1-ptf1 JAVA_HOME=/usr/lpp/java/J8.0 PYTHONPATH=/zoau/v1.0.1-ptf1/lib LIBPATH=/zoau/v1.0.1-ptf1/lib:/python2/usr/lpp/IBM/cyp/v3r9/pyz//lib:/lib:/usr/lib:. PATH=/zoau/v1.0.1-ptf1/bin:/python2/usr/lpp/IBM/cyp/v3r9/pyz//bin:/bin:/var/bin:/usr/lpp/java/J8.0/bin _CEE_RUNOPTS='"'"'"'"'"'"'"'"'FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'"'"'"'"'"'"'"'"' _TAG_REDIR_ERR=txt _TAG_REDIR_IN=txt _TAG_REDIR_OUT=txt LANG=C _ENCODE_FILE_NEW=IBM-1047 _ENCODE_FILE_EXISTING=IBM-1047 /python2/usr/lpp/IBM/cyp/v3r9/pyz/bin/python3.9 && sleep 0'"'"''
<ec33017a.vmec.svl.ibm.com> (0, b'\n{"changed": true, "path": "/tmp/ansible.enqveywg", "uid": 0, "gid": 1, "owner": "BPXROOT", "group": "OMVSGRP", "mode": "0600", "state": "file", "size": 0, "invocation": {"module_args": {"state": "file", "prefix": "ansible.", "suffix": "", "path": null}}}\n', b'')
<ec33017a.vmec.svl.ibm.com> ESTABLISH SSH CONNECTION FOR USER: omvsadm
<ec33017a.vmec.svl.ibm.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' ec33017a.vmec.svl.ibm.com '/bin/sh -c '"'"'echo ~omvsadm && sleep 0'"'"''
<ec33017a.vmec.svl.ibm.com> (0, b'/\n', b'')
<ec33017a.vmec.svl.ibm.com> ESTABLISH SSH CONNECTION FOR USER: omvsadm
<ec33017a.vmec.svl.ibm.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' ec33017a.vmec.svl.ibm.com '/bin/sh -c '"'"'( umask 77 && mkdir -p "` echo /.ansible/tmp `"&& mkdir "` echo /.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348 `" && echo ansible-tmp-1674884421.332384-50931-270040809269348="` echo /.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348 `" ) && sleep 0'"'"''
<ec33017a.vmec.svl.ibm.com> (0, b'ansible-tmp-1674884421.332384-50931-270040809269348=/.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348\n', b'')
Using module file /Users/ddimatos/ansible_versions/3_8_13/ansible-doc/lib/python3.8/site-packages/ansible/modules/stat.py
Pipelining is enabled.
<ec33017a.vmec.svl.ibm.com> ESTABLISH SSH CONNECTION FOR USER: omvsadm
<ec33017a.vmec.svl.ibm.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' ec33017a.vmec.svl.ibm.com '/bin/sh -c '"'"'_BPXK_AUTOCVT=ON ZOAU_HOME=/zoau/v1.0.1-ptf1 JAVA_HOME=/usr/lpp/java/J8.0 PYTHONPATH=/zoau/v1.0.1-ptf1/lib LIBPATH=/zoau/v1.0.1-ptf1/lib:/python2/usr/lpp/IBM/cyp/v3r9/pyz//lib:/lib:/usr/lib:. PATH=/zoau/v1.0.1-ptf1/bin:/python2/usr/lpp/IBM/cyp/v3r9/pyz//bin:/bin:/var/bin:/usr/lpp/java/J8.0/bin _CEE_RUNOPTS='"'"'"'"'"'"'"'"'FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'"'"'"'"'"'"'"'"' _TAG_REDIR_ERR=txt _TAG_REDIR_IN=txt _TAG_REDIR_OUT=txt LANG=C _ENCODE_FILE_NEW=IBM-1047 _ENCODE_FILE_EXISTING=IBM-1047 /python2/usr/lpp/IBM/cyp/v3r9/pyz/bin/python3.9 && sleep 0'"'"''
<ec33017a.vmec.svl.ibm.com> (0, b'\n{"changed": false, "stat": {"exists": true, "path": "/tmp/ansible.enqveywg", "mode": "0600", "isdir": false, "ischr": false, "isblk": false, "isreg": true, "isfifo": false, "islnk": false, "issock": false, "uid": 0, "gid": 1, "size": 0, "inode": 1607, "dev": 1, "nlink": 1, "atime": 1674884419.0, "mtime": 1674884419.0, "ctime": 1674884419.0, "wusr": true, "rusr": true, "xusr": false, "wgrp": false, "rgrp": false, "xgrp": false, "woth": false, "roth": false, "xoth": false, "isuid": false, "isgid": false, "blocks": 0, "block_size": 1024, "device_type": 0, "readable": true, "writeable": true, "executable": false, "pw_name": "BPXROOT", "gr_name": "OMVSGRP", "checksum": "da39a3ee5e6b4b0d3255bfef95601890afd80709", "mimetype": "unknown", "charset": "unknown", "version": null, "attributes": [], "attr_flags": ""}, "invocation": {"module_args": {"path": "/tmp/ansible.enqveywg", "follow": false, "get_checksum": true, "checksum_algorithm": "sha1", "get_md5": false, "get_mime": true, "get_attributes": true}}}\n', b'')
<ec33017a.vmec.svl.ibm.com> PUT /Users/ddimatos/git/github/playbooks/files/COMPLINK.jcl TO /.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348/source
<ec33017a.vmec.svl.ibm.com> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' '[ec33017a.vmec.svl.ibm.com]'
<ec33017a.vmec.svl.ibm.com> (0, b'sftp> put /Users/ddimatos/git/github/playbooks/files/COMPLINK.jcl /.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348/source\n', b'')
<ec33017a.vmec.svl.ibm.com> ESTABLISH SSH CONNECTION FOR USER: omvsadm
<ec33017a.vmec.svl.ibm.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' ec33017a.vmec.svl.ibm.com '/bin/sh -c '"'"'chmod u+x /.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348/ /.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348/source && sleep 0'"'"''
<ec33017a.vmec.svl.ibm.com> (0, b'', b'')
Using module file /Users/ddimatos/ansible_versions/3_8_13/ansible-doc/lib/python3.8/site-packages/ansible/modules/copy.py
Pipelining is enabled.
<ec33017a.vmec.svl.ibm.com> ESTABLISH SSH CONNECTION FOR USER: omvsadm
<ec33017a.vmec.svl.ibm.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' ec33017a.vmec.svl.ibm.com '/bin/sh -c '"'"'_BPXK_AUTOCVT=ON ZOAU_HOME=/zoau/v1.0.1-ptf1 JAVA_HOME=/usr/lpp/java/J8.0 PYTHONPATH=/zoau/v1.0.1-ptf1/lib LIBPATH=/zoau/v1.0.1-ptf1/lib:/python2/usr/lpp/IBM/cyp/v3r9/pyz//lib:/lib:/usr/lib:. PATH=/zoau/v1.0.1-ptf1/bin:/python2/usr/lpp/IBM/cyp/v3r9/pyz//bin:/bin:/var/bin:/usr/lpp/java/J8.0/bin _CEE_RUNOPTS='"'"'"'"'"'"'"'"'FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'"'"'"'"'"'"'"'"' _TAG_REDIR_ERR=txt _TAG_REDIR_IN=txt _TAG_REDIR_OUT=txt LANG=C _ENCODE_FILE_NEW=IBM-1047 _ENCODE_FILE_EXISTING=IBM-1047 /python2/usr/lpp/IBM/cyp/v3r9/pyz/bin/python3.9 && sleep 0'"'"''
<ec33017a.vmec.svl.ibm.com> (0, b'\n{"dest": "/tmp/ansible.enqveywg", "src": "/.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348/source", "md5sum": "6dec97e466b9ff254983f639c559c55d", "checksum": "882f111fd42a1ced61df351cf4c976384880c5f6", "changed": true, "uid": 0, "gid": 1, "owner": "BPXROOT", "group": "OMVSGRP", "mode": "0600", "state": "file", "size": 88, "invocation": {"module_args": {"src": "/.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348/source", "dest": "/tmp/ansible.enqveywg", "mode": "0600", "_original_basename": "COMPLINK.jcl", "backup": false, "force": true, "follow": false, "unsafe_writes": false, "content": null, "validate": null, "directory_mode": null, "remote_src": null, "local_follow": null, "checksum": null, "owner": null, "group": null, "seuser": null, "serole": null, "selevel": null, "setype": null, "attributes": null}}}\n', b'')
Using module file /Users/ddimatos/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py
Pipelining is enabled.
<ec33017a.vmec.svl.ibm.com> ESTABLISH SSH CONNECTION FOR USER: omvsadm
<ec33017a.vmec.svl.ibm.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' ec33017a.vmec.svl.ibm.com '/bin/sh -c '"'"'_BPXK_AUTOCVT=ON ZOAU_HOME=/zoau/v1.0.1-ptf1 JAVA_HOME=/usr/lpp/java/J8.0 PYTHONPATH=/zoau/v1.0.1-ptf1/lib LIBPATH=/zoau/v1.0.1-ptf1/lib:/python2/usr/lpp/IBM/cyp/v3r9/pyz//lib:/lib:/usr/lib:. PATH=/zoau/v1.0.1-ptf1/bin:/python2/usr/lpp/IBM/cyp/v3r9/pyz//bin:/bin:/var/bin:/usr/lpp/java/J8.0/bin _CEE_RUNOPTS='"'"'"'"'"'"'"'"'FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)'"'"'"'"'"'"'"'"' _TAG_REDIR_ERR=txt _TAG_REDIR_IN=txt _TAG_REDIR_OUT=txt LANG=C _ENCODE_FILE_NEW=IBM-1047 _ENCODE_FILE_EXISTING=IBM-1047 /python2/usr/lpp/IBM/cyp/v3r9/pyz/bin/python3.9 && sleep 0'"'"''


<ec33017a.vmec.svl.ibm.com> (0, b'\n{"changed": false, "duration": 11, "failed": true, "msg": "The JCL submitted with job id None but appears to be a long running job that exceeded its maximum wait time of 10 second(s). Consider using module zos_job_query to poll for a long running job or increase option \'wait_times_s` to a value greater than 11.", "invocation": {"module_args": {"src": "/Users/ddimatos/git/github/playbooks/files/COMPLINK.jcl", "location": "LOCAL", "wait": false, "encoding": {"from": "ISO8859-1", "to": "IBM-1047"}, "temp_file": "/tmp/ansible.enqveywg", "return_output": true, "wait_time_s": 10, "volume": null, "max_rc": null, "from_encoding": "ISO8859-1", "to_encoding": "IBM-1047"}}}\n', b'')
<ec33017a.vmec.svl.ibm.com> ESTABLISH SSH CONNECTION FOR USER: omvsadm
<ec33017a.vmec.svl.ibm.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="omvsadm"' -o ConnectTimeout=10 -o 'ControlPath="/Users/ddimatos/.ansible/cp/3311113a13"' ec33017a.vmec.svl.ibm.com '/bin/sh -c '"'"'rm -f -r /.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348/ > /dev/null 2>&1 && sleep 0'"'"''
<ec33017a.vmec.svl.ibm.com> (0, b'', b'')
fatal: [zvm]: FAILED! => {
    "changed": false,
    "checksum": "882f111fd42a1ced61df351cf4c976384880c5f6",
    "dest": "/tmp/ansible.enqveywg",
    "duration": 11,
    "gid": 1,
    "group": "OMVSGRP",
    "invocation": {
        "module_args": {
            "encoding": {
                "from": "ISO8859-1",
                "to": "IBM-1047"
            },
            "from_encoding": "ISO8859-1",
            "location": "LOCAL",
            "max_rc": null,
            "return_output": true,
            "src": "/Users/ddimatos/git/github/playbooks/files/COMPLINK.jcl",
            "temp_file": "/tmp/ansible.enqveywg",
            "to_encoding": "IBM-1047",
            "volume": null,
            "wait": false,
            "wait_time_s": 10
        }
    },
    "md5sum": "6dec97e466b9ff254983f639c559c55d",
    "mode": "0600",
    "msg": "The JCL submitted with job id None but appears to be a long running job that exceeded its maximum wait time of 10 second(s). Consider using module zos_job_query to poll for a long running job or increase option 'wait_times_s` to a value greater than 11.",
    "owner": "BPXROOT",
    "size": 88,
    "src": "/.ansible/tmp/ansible-tmp-1674884421.332384-50931-270040809269348/source",
    "state": "file",
    "uid": 0
}

Contents of ansible.cfg

No response

Contents of the inventory

No response

Contents of group_vars or host_vars

No response

Ansible version

ansible [core 2.11.12]
  config file = /Users/ddimatos/git/github/playbooks/ansible.cfg
  configured module search path = ['/Users/ddimatos/.ansible/collections/ansible_collections/ibm/ibm_zos_core/plugins/modules']
  ansible python module location = /Users/ddimatos/ansible_versions/3_8_13/ansible-doc/lib/python3.8/site-packages/ansible
  ansible collection location = /Users/ddimatos/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/ddimatos/ansible_versions/3_8_13/ansible-doc/bin/ansible
  python version = 3.8.13 (default, Jun 14 2022, 23:29:22) [Clang 13.0.0 (clang-1300.0.27.3)]
  jinja version = 3.1.2
  libyaml = True


### IBM z/OS Ansible core Version

v1.5.0-beta.1

### IBM ZOAU version

v1.2.2

### z/OS version

2.4

### Ansible module

zos_job_submit
@ddimatos ddimatos added the Bug Something isn't working as designed. label Jan 28, 2023
@ddimatos ddimatos added this to the [Q2] [2023] Bugs milestone Jan 29, 2023
@ddimatos
Copy link
Collaborator Author

May be related, but when I had invalid JCL compiling cobol i got what looks like an error due to long lines coming in job output, possibly the source is the dependency but did not have time to investigate, I think this might be related but will require more time to evaluate.

fatal: [zvm]: FAILED! => {"changed": true, "checksum": "d961875941f93dcf1619033c6fd00250bd5dd89d", "dest": "/tmp/ansible.9gvlxqvv", "gid": 1, "group": "OMVSGRP", "md5sum": "e38fca195156c05ce2917616ad3989c4", "mode": "0600", "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 100, in <module>\n  File \"<stdin>\", line 92, in _ansiballz_main\n  File \"<stdin>\", line 40, in invoke_module\n  File \"/python2/usr/lpp/IBM/cyp/v3r9/pyz/lib/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/python2/usr/lpp/IBM/cyp/v3r9/pyz/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/python2/usr/lpp/IBM/cyp/v3r9/pyz/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_k1wp8qe7/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 <module>\n  File \"/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_k1wp8qe7/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\n  File \"/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_k1wp8qe7/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py\", line 825, in run_module\n  File \"/tmp/ansible_ibm.ibm_zos_core.zos_job_submit_payload_k1wp8qe7/ansible_ibm.ibm_zos_core.zos_job_submit_payload.zip/ansible_collections/ibm/ibm_zos_core/plugins/modules/zos_job_submit.py\", line 660, in submit_src_jcl\nIndexError: list index out of range\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "owner": "BPXROOT", "rc": 1, "size": 796, "src": "/.ansible/tmp/ansible-tmp-1675193600.099925-5628-63749898006094/source", "state": "file", "uid": 0}

@ddimatos ddimatos changed the title [Bug] [zos_job_submit] I submitted local JCL and it returned with a stack trace [Bug] [zos_job_submit] Submitted local JCL returned with a stack trace Mar 17, 2023
@ddimatos
Copy link
Collaborator Author

I ran the above JCL with no JOB card on the latest code 1.5.0 which is not released yet and found it to be fine.

{
   "changed":false,
   "checksum":"882f111fd42a1ced61df351cf4c976384880c5f6",
   "dest":"/tmp/ansible.ilgvx14v",
   "duration":0,
   "gid":1,
   "group":"OMVSGRP",
   "jobs":[
      {
         "class":"",
         "content_type":"",
         "ddnames":[
            {
               "byte_count":"133",
               "content":[
                  "1                       J E S 2  J O B  L O G  --  S Y S T E M  S T L 1  --  N O D E  S T L 1",
                  "0     ",
                  " 23.06.03 JOB00345 ---- WEDNESDAY, 22 MAR 2023 ----",
                  " 23.06.03 JOB00345  IRR010I  USERID OMVSADM  IS ASSIGNED TO THIS JOB.",
                  " 23.06.03 JOB00345  IEFC452I CLGP - JOB NOT RUN - JCL ERROR  353",
                  "0------ JES2 JOB STATISTICS ------",
                  "0            3 CARDS READ",
                  "0           17 SYSOUT PRINT RECORDS",
                  "0            0 SYSOUT PUNCH RECORDS",
                  "0            1 SYSOUT SPOOL KBYTES",
                  "0         0.00 MINUTES EXECUTION TIME"
               ],
               "ddname":"JESMSGLG",
               "id":"2",
               "proctep":null,
               "record_count":"11",
               "stepname":"JES2"
            },
            {
               "byte_count":"136",
               "content":[
                  "        1 //CLGP JOB                                                              JOB00345",
                  "        2 //CLG EXEC IGYWCLG",
                  "        3 //COBOL.SYSIN DD DSN=IBMUSER.ANSIBLE.COBOL(HELLO),DISP=SH"
               ],
               "ddname":"JESJCL",
               "id":"3",
               "proctep":null,
               "record_count":"3",
               "stepname":"JES2"
            },
            {
               "byte_count":"137",
               "content":[
                  "  STMT NO. MESSAGE",
                  "         2 IEFC612I PROCEDURE IGYWCLG WAS NOT FOUND"
               ],
               "ddname":"JESYSMSG",
               "id":"4",
               "proctep":null,
               "record_count":"2",
               "stepname":"JES2"
            }
         ],
         "duration":0,
         "job_id":"JOB00345",
         "job_name":"CLGP",
         "owner":"OMVSADM",
         "ret_code":{
            "code":null,
            "msg":"JCL ERROR  353",
            "msg_code":null,
            "msg_text":"JCLERR",
            "steps":[
               
            ]
         },
         "subsystem":"STL1",
         "system":"STL1"
      }
   ],
   "md5sum":"6dec97e466b9ff254983f639c559c55d",
   "mode":"0600",
   "msg":"The JCL submitted with job id JOB00345 but there was an error, please review the error for further details: The job completion code (CC) was not in the job log. Please review the error JCL ERROR  353 and the job log.",
   "owner":"OBAGAOI",
   "size":88,
   "src":"/.ansible/tmp/ansible-tmp-1679551556.150913-64717-39614156984895/source",
   "state":"file",
   "stderr":"The job completion code (CC) was not in the job log. Please review the error JCL ERROR  353 and the job log.",
   "stderr_lines":[
      "The job completion code (CC) was not in the job log. Please review the error JCL ERROR  353 and the job log."
   ],
   "uid":0
}

@ddimatos
Copy link
Collaborator Author

I also tried with a more complete Job and only removed the job card, result is fine, see below:

{
   "changed":false,
   "checksum":"1c631b74f27531be081d4394d51a495a74ec0131",
   "dest":"/tmp/ansible.ni82rwqm",
   "duration":0,
   "gid":1,
   "group":"OMVSGRP",
   "jobs":[
      {
         "class":"",
         "content_type":"",
         "ddnames":[
            {
               "byte_count":"133",
               "content":[
                  "1                       J E S 2  J O B  L O G  --  S Y S T E M  S T L 1  --  N O D E  S T L 1",
                  "0     ",
                  " 23.06.03 JOB00345 ---- WEDNESDAY, 22 MAR 2023 ----",
                  " 23.06.03 JOB00345  IRR010I  USERID OMVSADM  IS ASSIGNED TO THIS JOB.",
                  " 23.06.03 JOB00345  IEFC452I CLGP - JOB NOT RUN - JCL ERROR  353",
                  "0------ JES2 JOB STATISTICS ------",
                  "0            3 CARDS READ",
                  "0           17 SYSOUT PRINT RECORDS",
                  "0            0 SYSOUT PUNCH RECORDS",
                  "0            1 SYSOUT SPOOL KBYTES",
                  "0         0.00 MINUTES EXECUTION TIME"
               ],
               "ddname":"JESMSGLG",
               "id":"2",
               "proctep":null,
               "record_count":"11",
               "stepname":"JES2"
            },
            {
               "byte_count":"136",
               "content":[
                  "        1 //CLGP JOB                                                              JOB00345",
                  "        2 //CLG EXEC IGYWCLG",
                  "        3 //COBOL.SYSIN DD DSN=IBMUSER.ANSIBLE.COBOL(HELLO),DISP=SH"
               ],
               "ddname":"JESJCL",
               "id":"3",
               "proctep":null,
               "record_count":"3",
               "stepname":"JES2"
            },
            {
               "byte_count":"137",
               "content":[
                  "  STMT NO. MESSAGE",
                  "         2 IEFC612I PROCEDURE IGYWCLG WAS NOT FOUND"
               ],
               "ddname":"JESYSMSG",
               "id":"4",
               "proctep":null,
               "record_count":"2",
               "stepname":"JES2"
            }
         ],
         "duration":0,
         "job_id":"JOB00345",
         "job_name":"CLGP",
         "owner":"OMVSADM",
         "ret_code":{
            "code":null,
            "msg":"JCL ERROR  353",
            "msg_code":null,
            "msg_text":"JCLERR",
            "steps":[
               
            ]
         },
         "subsystem":"STL1",
         "system":"STL1"
      }
   ],
   "md5sum":"7663107111afe01d5856f9b3c3311bea",
   "mode":"0600",
   "msg":"The JCL submitted with job id JOB00345 but there was an error, please review the error for further details: The job completion code (CC) was not in the job log. Please review the error JCL ERROR  353 and the job log.",
   "owner":"OBAGAOI",
   "size":791,
   "src":"/.ansible/tmp/ansible-tmp-1679551938.591239-65191-83891757133065/source",
   "state":"file",
   "stderr":"The job completion code (CC) was not in the job log. Please review the error JCL ERROR  353 and the job log.",
   "stderr_lines":[
      "The job completion code (CC) was not in the job log. Please review the error JCL ERROR  353 and the job log."
   ],
   "uid":0
}

@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] Submitted local JCL returned with a stack trace [Bug] [zos_job_submit] Submitted local invalid JCL and returned with a stack trace Mar 23, 2023
@ddimatos ddimatos moved this from 📗In plan to 🔍 Validation in IBM Ansible z/OS Core Collection Mar 23, 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

2 participants