Commit 09ec1327 authored by Julien Muchembled's avatar Julien Muchembled

Fix restarting in case of corrupted cache + small log fixes

parent 9a05367c
...@@ -21,9 +21,9 @@ def openvpn(iface, hello_interval, encrypt, *args, **kw): ...@@ -21,9 +21,9 @@ def openvpn(iface, hello_interval, encrypt, *args, **kw):
] + list(args) ] + list(args)
if not encrypt: if not encrypt:
args.extend(['--cipher', 'none']) args.extend(['--cipher', 'none'])
logging.trace('%r', args) logging.debug('%r', args)
fd = os.open(os.path.join(log, '%s.log' % iface), fd = os.open(os.path.join(log, '%s.log' % iface),
os.O_WRONLY | os.O_CREAT | os.O_APPEND) os.O_WRONLY | os.O_CREAT | os.O_APPEND, 0666)
try: try:
return subprocess.Popen(args, stdout=fd, stderr=subprocess.STDOUT, **kw) return subprocess.Popen(args, stdout=fd, stderr=subprocess.STDOUT, **kw)
finally: finally:
...@@ -31,7 +31,6 @@ def openvpn(iface, hello_interval, encrypt, *args, **kw): ...@@ -31,7 +31,6 @@ def openvpn(iface, hello_interval, encrypt, *args, **kw):
def server(iface, server_ip, ip_length, max_clients, dh_path, pipe_fd, port, proto, hello_interval, encrypt, *args, **kw): def server(iface, server_ip, ip_length, max_clients, dh_path, pipe_fd, port, proto, hello_interval, encrypt, *args, **kw):
logging.debug('Starting server...')
if server_ip: if server_ip:
script_up = '%s %s/%u' % (ovpn_server, server_ip, 64) script_up = '%s %s/%u' % (ovpn_server, server_ip, 64)
else: else:
...@@ -50,7 +49,6 @@ def server(iface, server_ip, ip_length, max_clients, dh_path, pipe_fd, port, pro ...@@ -50,7 +49,6 @@ def server(iface, server_ip, ip_length, max_clients, dh_path, pipe_fd, port, pro
def client(iface, server_address, pipe_fd, hello_interval, encrypt, *args, **kw): def client(iface, server_address, pipe_fd, hello_interval, encrypt, *args, **kw):
logging.debug('Starting client...')
remote = ['--nobind', remote = ['--nobind',
'--client', '--client',
'--up', ovpn_client, '--up', ovpn_client,
...@@ -68,7 +66,6 @@ def client(iface, server_address, pipe_fd, hello_interval, encrypt, *args, **kw) ...@@ -68,7 +66,6 @@ def client(iface, server_address, pipe_fd, hello_interval, encrypt, *args, **kw)
def router(network, subnet, subnet_size, interface_list, def router(network, subnet, subnet_size, interface_list,
wireless, hello_interval, verbose, pidfile, state_path, **kw): wireless, hello_interval, verbose, pidfile, state_path, **kw):
logging.info('Starting babel...')
args = ['babeld', args = ['babeld',
'-C', 'redistribute local ip %s/%s le %s' % (subnet, subnet_size, subnet_size), '-C', 'redistribute local ip %s/%s le %s' % (subnet, subnet_size, subnet_size),
'-C', 'redistribute local deny', '-C', 'redistribute local deny',
...@@ -103,5 +100,5 @@ def router(network, subnet, subnet_size, interface_list, ...@@ -103,5 +100,5 @@ def router(network, subnet, subnet_size, interface_list,
if wireless: if wireless:
args.append('-w') args.append('-w')
args = args + interface_list args = args + interface_list
logging.trace('%r', args) logging.info('%r', args)
return subprocess.Popen(args, **kw) return subprocess.Popen(args, **kw)
...@@ -143,7 +143,7 @@ def main(): ...@@ -143,7 +143,7 @@ def main():
interface_list, config.wireless, config.hello, config.babel_verb, interface_list, config.wireless, config.hello, config.babel_verb,
config.babel_pidfile, os.path.join(config.state, 'babeld.state'), config.babel_pidfile, os.path.join(config.state, 'babeld.state'),
stdout=os.open(os.path.join(config.log, 'babeld.log'), stdout=os.open(os.path.join(config.log, 'babeld.log'),
os.O_WRONLY | os.O_CREAT | os.O_APPEND), stderr=subprocess.STDOUT) os.O_WRONLY | os.O_CREAT | os.O_APPEND, 0666), stderr=subprocess.STDOUT)
# main loop # main loop
try: try:
...@@ -191,7 +191,7 @@ def main(): ...@@ -191,7 +191,7 @@ def main():
try: try:
sys.exitfunc() sys.exitfunc()
finally: finally:
os.execvp(sys.executable, sys.argv) os.execvp(sys.argv[0], sys.argv)
except KeyboardInterrupt: except KeyboardInterrupt:
return 0 return 0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment