From 4a8f2dde20f2c4afca50d582eaff9049d50c66bb Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Tue, 21 Mar 2017 09:15:23 -0700 Subject: [PATCH] fixes exception raised from ansible-connection logging (#22836) updates ansible-connection logging functions to use display instead of log. --- bin/ansible-connection | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/ansible-connection b/bin/ansible-connection index 3ebebe8910f..89e1158ef23 100755 --- a/bin/ansible-connection +++ b/bin/ansible-connection @@ -290,10 +290,10 @@ def main(): try: server = Server(sf_path, pc) except AnsibleConnectionFailure as exc: - log(str(exc), pc.remote_addr, pc.remote_user) + display.display(str(exc), pc.remote_addr, pc.remote_user, log_only=True) rc = 1 except Exception as exc: - log(traceback.format_exc(), pc.remote_addr, pc.remote_user) + display.display(traceback.format_exc(), pc.remote_addr, pc.remote_user, log_only=True) rc = 1 fcntl.lockf(lock_fd, fcntl.LOCK_UN) os.close(lock_fd) @@ -301,7 +301,7 @@ def main(): server.run() sys.exit(rc) else: - log('re-using existing socket connection', pc.remote_addr, pc.remote_user) + display.display('re-using existing socket connection', pc.remote_addr, pc.remote_user, log_only=True) fcntl.lockf(lock_fd, fcntl.LOCK_UN) os.close(lock_fd) @@ -326,8 +326,8 @@ def main(): time.sleep(C.PERSISTENT_CONNECT_INTERVAL) attempts += 1 if attempts > C.PERSISTENT_CONNECT_RETRIES: - log('number of connection attempts exceeded, unable to connect to control socket', pc.remote_addr, pc.remote_user) - log('persistent_connect_interval=%s, persistent_connect_retries=%s' % (C.PERSISTENT_CONNECT_INTERVAL, C.PERSISTENT_CONNECT_RETRIES), pc.remote_addr, pc.remote_user) + display.display('number of connection attempts exceeded, unable to connect to control socket', pc.remote_addr, pc.remote_user, log_only=True) + display.display('persistent_connect_interval=%s, persistent_connect_retries=%s' % (C.PERSISTENT_CONNECT_INTERVAL, C.PERSISTENT_CONNECT_RETRIES), pc.remote_addr, pc.remote_user, log_only=True) sys.stderr.write('failed to connect to control socket') sys.exit(255)