summaryrefslogtreecommitdiff
path: root/bin/ansible-connection
diff options
context:
space:
mode:
authorGanesh Nalawade <ganesh634@gmail.com>2019-04-03 09:40:31 +0530
committerGitHub <noreply@github.com>2019-04-03 09:40:31 +0530
commitd100faedb36201cb30dda02bcf6ff226710b286b (patch)
treebdf2e9ae21907e47540f3a41604916f3c1527491 /bin/ansible-connection
parent3694711a7e975324d52c258ab73a8f5e766a3f1c (diff)
downloadansible-d100faedb36201cb30dda02bcf6ff226710b286b.tar.gz
Add check to log jsonrpc request/response (#54606)
Fixes #54605 Add check in ansible-connection to check if persistent log message is enabled, if yes log the jsonrpc request in log file. With the current approach the _messages queue in `NetworkConnectionBase` is getting overwritten and response for `pop_message` api inovcation from ansible-connection is not recevied at the module side.
Diffstat (limited to 'bin/ansible-connection')
-rwxr-xr-xbin/ansible-connection9
1 files changed, 7 insertions, 2 deletions
diff --git a/bin/ansible-connection b/bin/ansible-connection
index 7f35aa981e..2b4855410e 100755
--- a/bin/ansible-connection
+++ b/bin/ansible-connection
@@ -136,13 +136,18 @@ class ConnectionProcess(object):
data = recv_data(s)
if not data:
break
- self.connection._log_messages("jsonrpc request: %s" % data)
+ log_messages = self.connection.get_option('persistent_log_messages')
+
+ if log_messages:
+ display.display("jsonrpc request: %s" % data, log_only=True)
signal.alarm(self.connection.get_option('persistent_command_timeout'))
resp = self.srv.handle_request(data)
signal.alarm(0)
- self.connection._log_messages("jsonrpc response: %s" % resp)
+ if log_messages:
+ display.display("jsonrpc response: %s" % resp, log_only=True)
+
send_data(s, to_bytes(resp))
s.close()