1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Merge pull request #15006 from ansible/local-pipelining

Add changes necessary for enabling pipelining for local connections
This commit is contained in:
Toshio Kuratomi 2016-03-20 22:12:07 -07:00
commit 9053d0468e

View file

@ -19,9 +19,9 @@ from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import os
import select
import shutil
import subprocess
import select
import fcntl
import getpass
@ -44,6 +44,7 @@ class Connection(ConnectionBase):
''' Local based connections '''
transport = 'local'
has_pipelining = True
def _connect(self):
''' connect to the local host; nothing to do here '''
@ -65,8 +66,6 @@ class Connection(ConnectionBase):
display.debug("in local.exec_command()")
if in_data:
raise AnsibleError("Internal Error: this module does not support optimized module pipelining")
executable = C.DEFAULT_EXECUTABLE.split()[0] if C.DEFAULT_EXECUTABLE else None
display.vvv(u"{0} EXEC {1}".format(self._play_context.remote_addr, cmd))
@ -112,7 +111,7 @@ class Connection(ConnectionBase):
fcntl.fcntl(p.stderr, fcntl.F_SETFL, fcntl.fcntl(p.stderr, fcntl.F_GETFL) & ~os.O_NONBLOCK)
display.debug("getting output with communicate()")
stdout, stderr = p.communicate()
stdout, stderr = p.communicate(in_data)
display.debug("done communicating")
display.debug("done with local.exec_command()")