Warn if eventlisten is unable to access socket

This commit is contained in:
Aditya Kulkarni 2014-08-21 12:46:46 -04:00
parent ef9494536e
commit 2d98bc16aa

View File

@ -63,6 +63,20 @@ def parse():
return opts
def check_access_and_print_warning(sock_dir):
'''
Check if this user is able to access the socket
directory and print a warning if not
'''
if (os.access(sock_dir, os.R_OK) and
os.access(sock_dir, os.W_OK) and
os.access(sock_dir, os.X_OK)):
return
else:
print('WARNING: Events will not be reported'
' (not able to access {0})'.format(sock_dir))
#def listen(sock_dir, node):
def listen(opts):
'''
@ -72,6 +86,7 @@ def listen(opts):
opts['node'],
opts['sock_dir']
)
check_access_and_print_warning(opts['sock_dir'])
print(event.puburi)
jid_counter = 0
found_minions = []