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():
try:
from . import Config
return Config.get_yaml_file()
except ModuleNotFoundError:
return "PYYAML needs to be installed. Execute \"pip3 install pyyaml\""
except ImportError:
except (ImportError, ModuleNotFoundError):
return "PYYAML needs to be installed. Execute \"pip3 install pyyaml\""
......
......@@ -171,12 +171,8 @@ def run_config(conf_file_path):
from pimdm import Config
pim_globals.MULTICAST_TABLE_ID, pim_globals.UNICAST_TABLE_ID = Config.get_vrfs(conf_file_path)
start(conf_file_path)
except ModuleNotFoundError:
print("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)
except (ImportError, ModuleNotFoundError):
sys.exit("PYYAML needs to be installed. Execute \"pip3 install pyyaml\"")
def print_multicast_routes(args):
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