Commit 845ec539 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 e9cbb4a0
......@@ -224,9 +224,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\""
......
......@@ -189,12 +189,8 @@ def main():
conf_file_path = os.path.abspath(args.config[0])
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\"")
elif args.verbose:
os.system("tail -f {}".format(PROCESS_LOG_STDOUT_FILE.format(pim_globals.MULTICAST_TABLE_ID)))
sys.exit(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