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

1043 bug title zos operator is passing wrong value to zoauopercmd #1044

Merged
Show file tree
Hide file tree
Changes from 10 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
bugfixes:
- zos_operator - The module was ignoring the wait time argument. The module now passes the wait time argument to zoau.
(https://github.com/ansible-collections/ibm_zos_core/pull/1044).

- zos_operator_action_query - The module was ignoring the wait time argument. The module now passes the wait time argument to zoau.
(https://github.com/ansible-collections/ibm_zos_core/pull/1044).
2 changes: 1 addition & 1 deletion plugins/modules/zos_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def run_operator_command(params):
use_wait_arg = True

if use_wait_arg:
kwargs.update({"wait_arg": True})
kwargs.update({"wait": True})

args = []
rc, stdout, stderr, elapsed = execute_command(cmdtxt, timeout=wait_s, *args, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion plugins/modules/zos_operator_action_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def run_module():
use_wait_arg = True

if use_wait_arg:
kwargs.update({"wait_arg": False})
kwargs.update({"wait": True})

args = []

Expand Down
31 changes: 25 additions & 6 deletions tests/functional/modules/test_zos_operator_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
import pytest
from pprint import pprint

from ansible_collections.ibm.ibm_zos_core.plugins.module_utils import (
zoau_version_checker
)


__metaclass__ = type


Expand Down Expand Up @@ -103,13 +108,9 @@ def test_zos_operator_positive_verbose_with_full_delay(ansible_zos_module):
def test_zos_operator_positive_verbose_with_quick_delay(ansible_zos_module):
hosts = ansible_zos_module
wait_time_s=10
#startmod = time.time()
results = hosts.all.zos_operator(
cmd="d u,all", verbose=True, wait_time_s=wait_time_s
)
# endmod = time.time()
# timediff = endmod - startmod
# assert timediff < 15

for result in results.contacted.values():
assert result["rc"] == 0
Expand All @@ -119,13 +120,31 @@ def test_zos_operator_positive_verbose_with_quick_delay(ansible_zos_module):
assert result.get('elapsed') <= (2 * wait_time_s)


def test_zos_operator_positive_verbose_blocking(ansible_zos_module):
if zoau_version_checker.is_zoau_version_higher_than("1.2.4.5"):
hosts = ansible_zos_module
wait_time_s=5
results = hosts.all.zos_operator(
cmd="d u,all", verbose=True, wait_time_s=wait_time_s
)

for result in results.contacted.values():
assert result["rc"] == 0
assert result.get("changed") is True
assert result.get("content") is not None
# Account for slower network
assert result.get('elapsed') >= wait_time_s



def test_response_come_back_complete(ansible_zos_module):
hosts = ansible_zos_module
results = hosts.all.zos_operator(cmd="\$dspl")
results = hosts.all.zos_operator(cmd="\\$dspl")
res = dict()
res["stdout"] = []
for result in results.contacted.values():
stdout = result.get('content')
# HASP646 Only appears in the last line that before did not appears
last_line = len(stdout)
assert "HASP646" in stdout[last_line - 1]
assert "HASP646" in stdout[last_line - 1]