Skip to content

Commit bbe133e

Browse files
[Bug][zos_mvs_raw] Return stderr in return values (#1808)
* Added stderr into return values * updated test case * Added changelog fragment * Modified ansible test
1 parent 45eb69f commit bbe133e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
bugfixes:
2+
- zos_mvs_raw - Module would not populate stderr return value. Fix now populates stderr in return values.
3+
(https://github.com/ansible-collections/ibm_zos_core/pull/1808).
4+

plugins/modules/zos_mvs_raw.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,7 +1898,7 @@ def run_module():
18981898
verbose=verbose,
18991899
tmphlq=tmphlq,
19001900
)
1901-
response = build_response(program_response.rc, dd_statements, program_response.stdout)
1901+
response = build_response(program_response.rc, dd_statements, program_response.stdout, program_response.stderr)
19021902
result = combine_dicts(result, response)
19031903
if program_response.rc != 0 :
19041904
raise ZOSRawError(
@@ -2766,7 +2766,7 @@ def run_zos_program(
27662766
return response
27672767

27682768

2769-
def build_response(rc, dd_statements, stdout):
2769+
def build_response(rc, dd_statements, stdout, stderr):
27702770
"""Build response dictionary to return at module completion.
27712771
27722772
Parameters
@@ -2785,6 +2785,7 @@ def build_response(rc, dd_statements, stdout):
27852785
response["backups"] = gather_backups(dd_statements)
27862786
response["dd_names"] = gather_output(dd_statements)
27872787
response["stdout"] = stdout
2788+
response["stderr"] = stderr
27882789
return response
27892790

27902791

tests/functional/modules/test_zos_mvs_raw_func.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ def test_disposition_new(ansible_zos_module, verbose):
101101
assert result.get("ret_code", {}).get("code", -1) == 0
102102
assert len(result.get("dd_names", [])) > 0
103103
assert result.get("failed", False) is False
104+
if verbose:
105+
assert result.get("stderr") is not None
104106
finally:
105107
hosts.all.zos_data_set(name=default_data_set, state="absent")
106108
if idcams_dataset:

0 commit comments

Comments
 (0)