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

Bugfix - corrects the dd_name used in jobs.py #507

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelogs/fragments/507-display-specific-ddname.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bugfixes:
- >
zos_job_output - fixes a bug that returned all ddname's when a specific
ddname was provided. Now a specific ddname can be returned and all others
ignored. (https://github.com/ansible-collections/ibm_zos_core/pull/507)
5 changes: 5 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ Version 1.4.0-beta.2

* fixed option `tag_ccsid` to correctly allow for type int.

* ``module_utils``

* jobs.py - fixes a utility used by module zos_job_output that would
truncate the DD content.

* Documentation

* Review :ref:`version 1.4.0-beta.1<my-reference-label>` release notes for additional content.
Expand Down
2 changes: 1 addition & 1 deletion plugins/module_utils/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def job_output(job_id=None, owner=None, job_name=None, dd_name=None):
job_id = parsed_args.get("job_id") or "*"
job_name = parsed_args.get("job_name") or "*"
owner = parsed_args.get("owner") or "*"
dd_name = parsed_args.get("ddname") or ""
dd_name = parsed_args.get("dd_name") or ""

job_detail = _get_job_output(job_id, owner, job_name, dd_name)
if len(job_detail) == 0:
Expand Down
20 changes: 20 additions & 0 deletions tests/functional/modules/test_zos_job_output_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,23 @@ def test_zos_job_output_job_exists(ansible_zos_module):
result.get("jobs")[0].get("ret_code").get("steps")[0].get("step_name")
== "STEP0001"
)


def test_zos_job_output_job_exists_with_filtered_ddname(ansible_zos_module):
hosts = ansible_zos_module
hosts.all.file(path=TEMP_PATH, state="directory")
hosts.all.shell(
cmd="echo {0} > {1}/SAMPLE".format(quote(JCL_FILE_CONTENTS), TEMP_PATH)
)
hosts.all.zos_job_submit(
src="{0}/SAMPLE".format(TEMP_PATH), location="USS", wait=True, volume=None
)
hosts.all.file(path=TEMP_PATH, state="absent")
dd_name = "JESMSGLG"
results = hosts.all.zos_job_output(job_name="HELLO", ddname=dd_name)
for result in results.contacted.values():
assert result.get("changed") is False
assert result.get("jobs") is not None
for job in result.get("jobs"):
assert len(job.get("ddnames")) == 1
assert job.get("ddnames")[0].get("ddname") == dd_name