From 88268181ff898bab9bd03af9e4892fc88ebd435a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Romain=20BRON=C3=88S?= <romain.brones@synchrotron-soleil.fr>
Date: Tue, 20 Feb 2024 14:21:32 +0100
Subject: [PATCH] fix: Check FofbIsRunning before running Utils method

---
 FofbTool/Utils.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/FofbTool/Utils.py b/FofbTool/Utils.py
index dc7606d..609b5cc 100644
--- a/FofbTool/Utils.py
+++ b/FofbTool/Utils.py
@@ -38,8 +38,13 @@ tangopath.update(tangopath_nodes)
 def init_opcua():
     """
     Run init on all OPCUA devices. Catch DevFailed and inform via log.
+    Does nothing if Fofb is running.
     """
 
+    if not check_fofbnotrunning():
+        logger.warning("Not running configuration of combpm because FOFB seems to be running.")
+        return
+
     for i,(n,p) in enumerate(tangopath_nodes.items()):
         logger.info("Perform init() on {} '{}'".format(n,p))
         try:
@@ -51,8 +56,13 @@ def init_opcua():
 def init_watcher():
     """
     Run init on Fofb-Watcher, waiting for its completion then init on the FofbCommand.
+    Does nothing if Fofb is running.
     """
 
+    if not check_fofbnotrunning():
+        logger.warning("Not running configuration of combpm because FOFB seems to be running.")
+        return
+
     try:
         wprx=tango.DeviceProxy(tangopath["fofb-watcher"])
         wprx.set_timeout_millis(30000)
-- 
GitLab