Skip to content

[Bug] [zos_job_submit] When a job that does not succeed for some conditions the job log is not returned  #655

@ddimatos

Description

@ddimatos

Bug description

The current implementation changed the behavior for failed conditions such that a verbose error message is returned with a reasonable explanation and embedded job name or job id. For automation this makes it a bit more difficult for tasks to have to extract the job_id and then pass it to the zos_job_output module to get the log to see why the failure happened.

While its not understood why the change in behavior was introduced it is more complete in its error detection and reasons.

Its also not determined if the original behavior should be restored or consider new options like verbose that would share the job log. The other idea is to update the JSON response to include the job_name and job_id always but this could be duplicate information if the verbose option is supported as now you would have job_id in two places which might be acceptable.

More thought has to go into this change and what the desirable flow should look like for automation whether or not its necessary to always dump the job log as they can be quite long and scroll screens and in one case I had seen a sizable job log use up all the default heap allocated to subprocess which is about 1024K. Although, its unlikely not sharing the log would aid in the HEAP issue because this happens on the managed node before the controller receives the log.

The work around for now would be to scan the message with a regular expression and extract the Job ID.

    "msg": "The JCL submitted with job id JOB03991 but there was an error, please review the error for further details: The job return code, 'ret_code[code]' 12 for the submitted job is greater than the value set for option 'max_rc' 4. Increase the value for 'max_rc' otherwise this job submission has failed..",

Playbook verbosity output

fatal: [zos_host_01]: FAILED! => {
    "changed": false,
    "checksum": "1c0e61e136e58bbd623e797d844986a2cf50e22d",
    "dest": "/tmp/xxxxxx",
    "duration": 0,
    "gid": 100,
    "group": "group",
    "invocation": {
        "module_args": {
            "encoding": {
                "from": "UTF-8",
                "to": "IBM-1047"
            },
            "from_encoding": "UTF-8",
            "location": "LOCAL",
            "max_rc": 4,
            "return_output": true,
            "src": "/tmp/some.jcl,
            "temp_file": "/tmp/xxxxx",
            "to_encoding": "IBM-1047",
            "volume": null,
            "wait": true,
            "wait_time_s": 10
        }
    },
    "md5sum": "809cd3f4fc1ecb2bff82f33491f34d9f",
    "mode": "0600",
    "msg": "The JCL submitted with job id JOB03991 but there was an error, please review the error for further details: The job return code, 'ret_code[code]' 12 for the submitted job is greater than the value set for option 'max_rc' 4. Increase the value for 'max_rc' otherwise this job submission has failed..",
    "owner": "owner",
    "size": 1232,
    "src": "/u/....,
    "state": "file",
    "uid": 10030
}

Contents of ansible.cfg

No response

Contents of the inventory

No response

Contents of group_vars or host_vars

No response

Ansible version

2.11.12

IBM z/OS Ansible core Version

v1.5.0-beta.1

IBM ZOAU version

v1.2.2

z/OS version

2.5

Ansible module

zos_job_submit

Metadata

Metadata

Assignees

Labels

BugSomething isn't working as designed.

Type

No type

Projects

Status

✅ Done

Relationships

None yet

Development

No branches or pull requests

Issue actions