mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fallback to systemd_notify_call() in case of socket.error
This commit is contained in:
parent
f1765472dd
commit
79c53f3f81
1 changed files with 7 additions and 4 deletions
|
@ -62,10 +62,13 @@ def notify_systemd():
|
|||
# Handle abstract namespace socket
|
||||
if notify_socket.startswith('@'):
|
||||
notify_socket = '\0{0}'.format(notify_socket[1:])
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
||||
sock.connect(notify_socket)
|
||||
sock.sendall('READY=1'.encode())
|
||||
sock.close()
|
||||
try:
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
|
||||
sock.connect(notify_socket)
|
||||
sock.sendall('READY=1'.encode())
|
||||
sock.close()
|
||||
except socket.error:
|
||||
return systemd_notify_call('--ready')
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue