From 5a1f51b3ebaca2e32079b84e7183a889bb9b9f5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20BRON=C3=88S?= <romain.brones@synchrotron-soleil.fr> Date: Thu, 1 Feb 2024 15:04:59 +0100 Subject: [PATCH] fix: Put guard on CLI, do nothing if FOFB is running * There is a '--force' flag to force it --- bin/FofbTool | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/bin/FofbTool b/bin/FofbTool index b50d585..8264801 100755 --- a/bin/FofbTool +++ b/bin/FofbTool @@ -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() -- GitLab