Commit cad9cdbd authored by Vitaly Lipatov's avatar Vitaly Lipatov

gateway: fail on invalid switcher configuration

parent 13a760fc
...@@ -36,7 +36,7 @@ except OSError: ...@@ -36,7 +36,7 @@ except OSError:
log = open (path_to_log,'a') log = open (path_to_log,'a')
except OSError: except OSError:
print ("Unknown error with logfile") print ("Unknown error with logfile")
sys.exit() sys.exit(1)
def parse_config (path_to_config, path_to_log): def parse_config (path_to_config, path_to_log):
...@@ -45,7 +45,7 @@ def parse_config (path_to_config, path_to_log): ...@@ -45,7 +45,7 @@ def parse_config (path_to_config, path_to_log):
info +=' ' + 'Problem in config file (' + path_to_config + '). Check him!' info +=' ' + 'Problem in config file (' + path_to_config + '). Check him!'
with open(path_to_log, "a") as log_file: with open(path_to_log, "a") as log_file:
log_file.write(info) log_file.write(info)
sys.exit() sys.exit(1)
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.read(path_to_config) config.read(path_to_config)
...@@ -96,14 +96,14 @@ def parse_config (path_to_config, path_to_log): ...@@ -96,14 +96,14 @@ def parse_config (path_to_config, path_to_log):
info += " Problem in config file (" + path_to_config + "): " + str(error) + "\n" info += " Problem in config file (" + path_to_config + "): " + str(error) + "\n"
with open(path_to_log, "a") as log_file: with open(path_to_log, "a") as log_file:
log_file.write(info) log_file.write(info)
sys.exit() sys.exit(1)
if redis_server == "redis_server" or ban_server == "ban_server" or not wan_ifaces: if redis_server == "redis_server" or ban_server == "ban_server" or not wan_ifaces:
info = time.strftime( "%Y-%m-%d %H:%M:%S", time.localtime()) info = time.strftime( "%Y-%m-%d %H:%M:%S", time.localtime())
info +=' ' + 'Problem in config file (' + path_to_config + '). Check him!' info +=' ' + 'Problem in config file (' + path_to_config + '). Check him!'
with open(path_to_log, "a") as log_file: with open(path_to_log, "a") as log_file:
log_file.write(info) log_file.write(info)
sys.exit() sys.exit(1)
else: else:
return (redis_server, ban_server, ban_server_ipv6, wan_ifaces, internal_interface, maxelem, whitelist_file) return (redis_server, ban_server, ban_server_ipv6, wan_ifaces, internal_interface, maxelem, whitelist_file)
......
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