Skip to content
Snippets Groups Projects
Commit 5a1f51b3 authored by BRONES Romain's avatar BRONES Romain
Browse files

fix: Put guard on CLI, do nothing if FOFB is running

* There is a '--force' flag to force it
parent 8434e8de
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,9 @@ if __name__ == '__main__':
parser.add_argument("--log", default="info",
help="Log level (error, warning, info, debug)")
parser.add_argument("--force", action="store_true",
help="Force operation even if FOFB is running.")
parser.add_argument("--conf-file", type=str,
help="Path to config file to apply.")
......@@ -72,6 +75,15 @@ if __name__ == '__main__':
FofbTool.Configuration.loadconfig(args.conf_file)
FofbTool.Configuration.logdebugconf()
## Check running
if not FofbTool.Utils.check_fofbnotrunning():
logger.warning("FOFB is running")
if not args.force:
logger.warning("Stoping here")
exit(1)
else:
logger.warning("Action forced")
## Device Server related commands
if args.DS_init_opcua:
FofbTool.Utils.init_opcua()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment