From 83e7b3857322d742330f7a588fcdb4111858e303 Mon Sep 17 00:00:00 2001
From: Federico Stagni <federico.stagni@cern.ch>
Date: Wed, 31 Jul 2024 16:28:14 +0200
Subject: [PATCH] Merge branch 'ro_expose' into 'master'

feat: distinguish writeable and read-only SEs in DIRAC topology

See merge request lhcb-dirac/LHCbDIRAC!1617

(cherry picked from commit b6d84c0b685705080477abdb606478fb3b882057)

005eadb5 feat: distinguish writeable and read-only SEs in DIRAC topology
4f283ead Lint
---
 .../ResourceStatusSystem/Agent/NagiosTopologyAgent.py | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/LHCbDIRAC/ResourceStatusSystem/Agent/NagiosTopologyAgent.py b/src/LHCbDIRAC/ResourceStatusSystem/Agent/NagiosTopologyAgent.py
index 823e4eb731..9dbe981b09 100644
--- a/src/LHCbDIRAC/ResourceStatusSystem/Agent/NagiosTopologyAgent.py
+++ b/src/LHCbDIRAC/ResourceStatusSystem/Agent/NagiosTopologyAgent.py
@@ -167,22 +167,21 @@ class NagiosTopologyAgent(AgentModule):
                 diracSE = StorageElement(se)  # this 'se' is .e.g. 'CERN-DST-EOS'
                 seDetailsForDIRACSE = dict()
                 seStorageSharesForDIRACSE = dict()
+                writeProtocols = diracSE.localWriteProtocolList
                 for diracSEoption in diracSE.protocolOptions:
                     # Building the storage_endpoints section
                     seDetails = dict()
+                    proto = diracSEoption["Protocol"]
                     ep = os.path.join(
-                        diracSEoption["Protocol"]
-                        + "://"
-                        + diracSEoption["Host"].strip("/")
-                        + ":"
-                        + diracSEoption["Port"],
+                        proto + "://" + diracSEoption["Host"].strip("/") + ":" + diracSEoption["Port"],
                         diracSEoption["Path"].strip("/"),
                     )
                     seDetails["endpoint_url"] = ep
                     seDetails["ipv6_status"] = isHostIPV6(urlparse(ep).hostname)
-                    seDetails["interface_type"] = diracSEoption["Protocol"]
+                    seDetails["interface_type"] = proto
                     seDetails["monitored"] = "yes" if wlcgName else "no"
                     seDetails["quality_level"] = "production"
+                    seDetails["read_only"] = not (proto in writeProtocols)
 
                     dseep = "_".join([se, diracSEoption["Protocol"]])  # just a unique name e.g. 'CERN-DST-EOS_root'
                     seDetailsForDIRACSE[dseep] = seDetails
-- 
GitLab