summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorNathaniel Case <this.is@nathanielca.se>2018-05-21 16:58:35 +0200
committerJohn R Barker <john@johnrbarker.com>2018-05-21 16:58:35 +0200
commit483df136266c6e7600e7f02ee718a8b1be803461 (patch)
treee2ea5e6311185fc11342a1f388c8c66656c89a91 /bin
parentMove summary to top for issue template (#40401) (diff)
downloadansible-483df136266c6e7600e7f02ee718a8b1be803461.tar.xz
ansible-483df136266c6e7600e7f02ee718a8b1be803461.zip
Fixing issues with httpapi (#40388)
* I seem to have forgotten the back half of tests * Set http timeout from persistent_command_timeout * Tweak URL generation and provide URL on error * Push var_options to connection process * Don't wait forever if coming from persistent * Don't send the entire contents of variables to ansible-connection
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ansible-connection17
1 files changed, 14 insertions, 3 deletions
diff --git a/bin/ansible-connection b/bin/ansible-connection
index 006bcd7787..f387199d82 100755
--- a/bin/ansible-connection
+++ b/bin/ansible-connection
@@ -69,7 +69,7 @@ class ConnectionProcess(object):
self.connection = None
self._ansible_playbook_pid = ansible_playbook_pid
- def start(self):
+ def start(self, variables):
try:
messages = list()
result = {}
@@ -83,7 +83,7 @@ class ConnectionProcess(object):
self.play_context.private_key_file = os.path.join(self.original_path, self.play_context.private_key_file)
self.connection = connection_loader.get(self.play_context.connection, self.play_context, '/dev/null',
ansible_playbook_pid=self._ansible_playbook_pid)
- self.connection.set_options()
+ self.connection.set_options(var_options=variables)
self.connection._connect()
self.connection._socket_path = self.socket_path
self.srv.register(self.connection)
@@ -201,10 +201,21 @@ def main():
init_data += cur_line
cur_line = stdin.readline()
+ cur_line = stdin.readline()
+ vars_data = b''
+
+ while cur_line.strip() != b'#END_VARS#':
+ if cur_line == b'':
+ raise Exception("EOF found before vars data was complete")
+ vars_data += cur_line
+ cur_line = stdin.readline()
+
if PY3:
pc_data = cPickle.loads(init_data, encoding='bytes')
+ variables = cPickle.loads(vars_data, encoding='bytes')
else:
pc_data = cPickle.loads(init_data)
+ variables = cPickle.loads(vars_data)
play_context = PlayContext()
play_context.deserialize(pc_data)
@@ -242,7 +253,7 @@ def main():
os.close(r)
wfd = os.fdopen(w, 'w')
process = ConnectionProcess(wfd, play_context, socket_path, original_path, ansible_playbook_pid)
- process.start()
+ process.start(variables)
except Exception:
messages.append(traceback.format_exc())
rc = 1