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:
commit
9053d0468e
1 changed files with 3 additions and 4 deletions
|
@ -19,9 +19,9 @@ from __future__ import (absolute_import, division, print_function)
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import select
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import select
|
|
||||||
import fcntl
|
import fcntl
|
||||||
import getpass
|
import getpass
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ class Connection(ConnectionBase):
|
||||||
''' Local based connections '''
|
''' Local based connections '''
|
||||||
|
|
||||||
transport = 'local'
|
transport = 'local'
|
||||||
|
has_pipelining = True
|
||||||
|
|
||||||
def _connect(self):
|
def _connect(self):
|
||||||
''' connect to the local host; nothing to do here '''
|
''' connect to the local host; nothing to do here '''
|
||||||
|
@ -65,8 +66,6 @@ class Connection(ConnectionBase):
|
||||||
|
|
||||||
display.debug("in local.exec_command()")
|
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
|
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))
|
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)
|
fcntl.fcntl(p.stderr, fcntl.F_SETFL, fcntl.fcntl(p.stderr, fcntl.F_GETFL) & ~os.O_NONBLOCK)
|
||||||
|
|
||||||
display.debug("getting output with communicate()")
|
display.debug("getting output with communicate()")
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate(in_data)
|
||||||
display.debug("done communicating")
|
display.debug("done communicating")
|
||||||
|
|
||||||
display.debug("done with local.exec_command()")
|
display.debug("done with local.exec_command()")
|
||||||
|
|
Loading…
Reference in a new issue