mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
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
This commit is contained in:
committed by
John R Barker
parent
231c3586bd
commit
483df13626
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user