fixes exception raised from ansible-connection logging (#22836)
updates ansible-connection logging functions to use display instead of log.
This commit is contained in:
parent
d6787632c9
commit
4a8f2dde20
1 changed files with 5 additions and 5 deletions
|
@ -290,10 +290,10 @@ def main():
|
||||||
try:
|
try:
|
||||||
server = Server(sf_path, pc)
|
server = Server(sf_path, pc)
|
||||||
except AnsibleConnectionFailure as exc:
|
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
|
rc = 1
|
||||||
except Exception as exc:
|
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
|
rc = 1
|
||||||
fcntl.lockf(lock_fd, fcntl.LOCK_UN)
|
fcntl.lockf(lock_fd, fcntl.LOCK_UN)
|
||||||
os.close(lock_fd)
|
os.close(lock_fd)
|
||||||
|
@ -301,7 +301,7 @@ def main():
|
||||||
server.run()
|
server.run()
|
||||||
sys.exit(rc)
|
sys.exit(rc)
|
||||||
else:
|
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)
|
fcntl.lockf(lock_fd, fcntl.LOCK_UN)
|
||||||
os.close(lock_fd)
|
os.close(lock_fd)
|
||||||
|
|
||||||
|
@ -326,8 +326,8 @@ def main():
|
||||||
time.sleep(C.PERSISTENT_CONNECT_INTERVAL)
|
time.sleep(C.PERSISTENT_CONNECT_INTERVAL)
|
||||||
attempts += 1
|
attempts += 1
|
||||||
if attempts > C.PERSISTENT_CONNECT_RETRIES:
|
if attempts > C.PERSISTENT_CONNECT_RETRIES:
|
||||||
log('number of connection attempts exceeded, unable to connect to control socket', 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)
|
||||||
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('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.stderr.write('failed to connect to control socket')
|
||||||
sys.exit(255)
|
sys.exit(255)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue