Commit 268a1d95 authored by Léo-Paul Géneau's avatar Léo-Paul Géneau 👾

Run.py: exit with error if config command failed

Exit with an error if config command fails because 'PyYAML' is missing.
parent e94b37bb
...@@ -231,9 +231,7 @@ def get_config(): ...@@ -231,9 +231,7 @@ def get_config():
try: try:
from . import Config from . import Config
return Config.get_yaml_file() return Config.get_yaml_file()
except ModuleNotFoundError: except (ImportError, ModuleNotFoundError):
return "PYYAML needs to be installed. Execute \"pip3 install pyyaml\""
except ImportError:
return "PYYAML needs to be installed. Execute \"pip3 install pyyaml\"" return "PYYAML needs to be installed. Execute \"pip3 install pyyaml\""
......
...@@ -171,12 +171,8 @@ def run_config(conf_file_path): ...@@ -171,12 +171,8 @@ def run_config(conf_file_path):
from pimdm import Config from pimdm import Config
pim_globals.MULTICAST_TABLE_ID, pim_globals.UNICAST_TABLE_ID = Config.get_vrfs(conf_file_path) pim_globals.MULTICAST_TABLE_ID, pim_globals.UNICAST_TABLE_ID = Config.get_vrfs(conf_file_path)
start(conf_file_path) start(conf_file_path)
except ModuleNotFoundError: except (ImportError, ModuleNotFoundError):
print("PYYAML needs to be installed. Execute \"pip3 install pyyaml\"") sys.exit("PYYAML needs to be installed. Execute \"pip3 install pyyaml\"")
sys.exit(0)
except ImportError:
print("PYYAML needs to be installed. Execute \"pip3 install pyyaml\"")
sys.exit(0)
def print_multicast_routes(args): def print_multicast_routes(args):
if args.ipv4 or not args.ipv6: if args.ipv4 or not args.ipv6:
......
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