From 1346c209b0daed77dfc79fec6d670ba13ff66f70 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 16 Mar 2016 12:47:52 -0700 Subject: [PATCH] Add changes necessary for enabling pipelining for local connections --- lib/ansible/plugins/connection/local.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/ansible/plugins/connection/local.py b/lib/ansible/plugins/connection/local.py index 9a956ca7359..00ee3bc7071 100644 --- a/lib/ansible/plugins/connection/local.py +++ b/lib/ansible/plugins/connection/local.py @@ -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()")