Merge "Ansible command module: allow to use stdin param"
This commit is contained in:
commit
e4b2e2c0ef
|
@ -2,3 +2,16 @@
|
|||
tasks:
|
||||
- name: Some command
|
||||
command: echo 123
|
||||
|
||||
- name: Check that 'stdin' parameter is handled by 'zuul_run_command' (which
|
||||
is a fork of ansible.module_utils.basic.run_command)
|
||||
command:
|
||||
cmd: cat -
|
||||
stdin: test_stdin_param
|
||||
register: _run_command_result
|
||||
|
||||
- assert:
|
||||
that:
|
||||
- _run_command_result is success
|
||||
- _run_command_result.rc == 0
|
||||
- "_run_command_result.stdout == 'test_stdin_param'"
|
||||
|
|
|
@ -421,15 +421,15 @@ def zuul_run_command(self, args, zuul_log_id, check_rc=False, close_fds=True, ex
|
|||
#
|
||||
# # ZUUL: stderr follows stdout
|
||||
# rpipes = [cmd.stdout]
|
||||
#
|
||||
# if data:
|
||||
# if not binary_data:
|
||||
# data += '\n'
|
||||
# if isinstance(data, text_type):
|
||||
# data = to_bytes(data)
|
||||
# cmd.stdin.write(data)
|
||||
# cmd.stdin.close()
|
||||
#
|
||||
|
||||
if data:
|
||||
if not binary_data:
|
||||
data += '\n'
|
||||
if isinstance(data, text_type):
|
||||
data = to_bytes(data)
|
||||
cmd.stdin.write(data)
|
||||
cmd.stdin.close()
|
||||
|
||||
# while True:
|
||||
# rfds, wfds, efds = select.select(rpipes, [], rpipes, 1)
|
||||
# stdout += self._read_from_pipes(rpipes, rfds, cmd.stdout)
|
||||
|
|
Loading…
Reference in New Issue