From decaa64595063491de5276082d1e3f7dde4a7921 Mon Sep 17 00:00:00 2001 From: Oscar Fernando Flores Garcia Date: Wed, 8 Jun 2022 16:31:55 -0500 Subject: [PATCH 1/5] Fixed dd_name typo bug to enable ddname job output filtering --- plugins/module_utils/job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/module_utils/job.py b/plugins/module_utils/job.py index ffa6a90bd..8869e8acf 100644 --- a/plugins/module_utils/job.py +++ b/plugins/module_utils/job.py @@ -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: From 24135db58a7890996fd65ef1d197b51242a2dc67 Mon Sep 17 00:00:00 2001 From: Oscar Fernando Flores Garcia Date: Wed, 8 Jun 2022 16:32:35 -0500 Subject: [PATCH 2/5] Added functional test case for ddname job output filtering Conflicts: tests/functional/modules/test_zos_job_output_func.py --- .../modules/test_zos_job_output_func.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/functional/modules/test_zos_job_output_func.py b/tests/functional/modules/test_zos_job_output_func.py index 907051ee9..35bb1f8f4 100644 --- a/tests/functional/modules/test_zos_job_output_func.py +++ b/tests/functional/modules/test_zos_job_output_func.py @@ -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="SAMPLE", 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 From 07bb57788daafac45460bedf7f4e863d07de1413 Mon Sep 17 00:00:00 2001 From: ddimatos Date: Wed, 5 Oct 2022 12:40:07 -0700 Subject: [PATCH 3/5] Updated release notes and changelog fragment Signed-off-by: ddimatos --- changelogs/fragments/507-display-specific-ddname.yml | 5 +++++ docs/source/release_notes.rst | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 changelogs/fragments/507-display-specific-ddname.yml diff --git a/changelogs/fragments/507-display-specific-ddname.yml b/changelogs/fragments/507-display-specific-ddname.yml new file mode 100644 index 000000000..2be1d8d16 --- /dev/null +++ b/changelogs/fragments/507-display-specific-ddname.yml @@ -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) diff --git a/docs/source/release_notes.rst b/docs/source/release_notes.rst index fc4dc72b7..8b88f3b7b 100644 --- a/docs/source/release_notes.rst +++ b/docs/source/release_notes.rst @@ -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` release notes for additional content. From 18f26739f11b6561d2a339295b6f57c30c5ced02 Mon Sep 17 00:00:00 2001 From: ddimatos Date: Wed, 5 Oct 2022 12:49:04 -0700 Subject: [PATCH 4/5] Corrent lint space issue around opertor Signed-off-by: ddimatos --- tests/functional/modules/test_zos_job_output_func.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/modules/test_zos_job_output_func.py b/tests/functional/modules/test_zos_job_output_func.py index 35bb1f8f4..8736e5363 100644 --- a/tests/functional/modules/test_zos_job_output_func.py +++ b/tests/functional/modules/test_zos_job_output_func.py @@ -103,7 +103,7 @@ def test_zos_job_output_job_exists_with_filtered_ddname(ansible_zos_module): src="{0}/SAMPLE".format(TEMP_PATH), location="USS", wait=True, volume=None ) hosts.all.file(path=TEMP_PATH, state="absent") - dd_name="JESMSGLG" + dd_name = "JESMSGLG" results = hosts.all.zos_job_output(job_name="SAMPLE", ddname=dd_name) for result in results.contacted.values(): assert result.get("changed") is False From 0eb88232902ba073ff2d995c71e6a2341d261c13 Mon Sep 17 00:00:00 2001 From: ddimatos Date: Wed, 5 Oct 2022 14:55:11 -0700 Subject: [PATCH 5/5] Update test case with updated HELLO job name Signed-off-by: ddimatos --- tests/functional/modules/test_zos_job_output_func.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/functional/modules/test_zos_job_output_func.py b/tests/functional/modules/test_zos_job_output_func.py index 8736e5363..08278512f 100644 --- a/tests/functional/modules/test_zos_job_output_func.py +++ b/tests/functional/modules/test_zos_job_output_func.py @@ -104,7 +104,7 @@ def test_zos_job_output_job_exists_with_filtered_ddname(ansible_zos_module): ) hosts.all.file(path=TEMP_PATH, state="absent") dd_name = "JESMSGLG" - results = hosts.all.zos_job_output(job_name="SAMPLE", ddname=dd_name) + 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