Skip to content

Commit e350670

Browse files
committed
refactor (Operations): remove the Setup subsections
1 parent 88c3cdd commit e350670

File tree

1 file changed

+10
-76
lines changed

1 file changed

+10
-76
lines changed

src/DIRAC/ConfigurationSystem/Client/Helpers/Operations.py

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,19 @@
66
77
Operations/
88
Defaults/
9+
someOption = someValue
10+
aSecondOption = aSecondValue
11+
specificVo/
912
someSection/
10-
someOption = someValue
11-
aSecondOption = aSecondValue
12-
Production/
13-
someSection/
14-
someOption = someValueInProduction
15-
aSecondOption = aSecondValueInProduction
16-
Certification/
17-
someSection/
18-
someOption = someValueInCertification
13+
someOption = someValueInVO
1914
2015
The following calls would give different results based on the setup::
2116
2217
Operations().getValue('someSection/someOption')
23-
- someValueInProduction if we are in 'Production' setup
24-
- someValueInCertification if we are in 'Certification' setup
25-
26-
Operations().getValue('someSection/aSecondOption')
27-
- aSecondValueInProduction if we are in 'Production' setup
28-
- aSecondValue if we are in 'Certification' setup <- looking in Defaults
29-
since there's no Certification/someSection/aSecondOption
30-
18+
- someValueInVO if we are in 'specificVo' vo
19+
- someValue if we are in any other VO
3120
32-
At the same time, for multi-VO installations, it is also possible to specify different options per-VO,
33-
like the following::
34-
35-
Operations/
36-
aVOName/
37-
Defaults/
38-
someSection/
39-
someOption = someValue
40-
aSecondOption = aSecondValue
41-
Production/
42-
someSection/
43-
someOption = someValueInProduction
44-
aSecondOption = aSecondValueInProduction
45-
Certification/
46-
someSection/
47-
someOption = someValueInCertification
48-
anotherVOName/
49-
Defaults/
50-
someSectionName/
51-
someOptionX = someValueX
52-
aSecondOption = aSecondValue
53-
setupName/
54-
someSection/
55-
someOption = someValueInProduction
56-
aSecondOption = aSecondValueInProduction
57-
58-
For this case it becomes then important for the Operations() objects to know the VO name
21+
It becomes then important for the Operations() objects to know the VO name
5922
for which we want the information, and this can be done in the following ways.
6023
6124
1. by specifying the VO name directly::
@@ -98,9 +61,7 @@ def __init__(self, vo=False, group=False, setup=False):
9861
"""
9962
self.__uVO = vo
10063
self.__uGroup = group
101-
self.__uSetup = setup
10264
self.__vo = False
103-
self.__setup = False
10465
self.__discoverSettings()
10566

10667
def __discoverSettings(self):
@@ -119,12 +80,6 @@ def __discoverSettings(self):
11980
result = getVOfromProxyGroup()
12081
if result["OK"]:
12182
self.__vo = result["Value"]
122-
# Set the setup
123-
self.__setup = False
124-
if self.__uSetup:
125-
self.__setup = self.__uSetup
126-
else:
127-
self.__setup = CSGlobals.getSetup()
12883

12984
def __getCache(self):
13085
Operations.__cacheLock.acquire()
@@ -134,7 +89,7 @@ def __getCache(self):
13489
Operations.__cache = {}
13590
Operations.__cacheVersion = currentVersion
13691

137-
cacheKey = (self.__vo, self.__setup)
92+
cacheKey = (self.__vo,)
13893
if cacheKey in Operations.__cache:
13994
return Operations.__cache[cacheKey]
14095

@@ -155,14 +110,13 @@ def __getCache(self):
155110
pass
156111

157112
def __getSearchPaths(self):
158-
paths = ["/Operations/Defaults", f"/Operations/{self.__setup}"]
113+
paths = ["/Operations/Defaults"]
159114
if not self.__vo:
160115
globalVO = CSGlobals.getVO()
161116
if not globalVO:
162117
return paths
163118
self.__vo = CSGlobals.getVO()
164-
paths.append(f"/Operations/{self.__vo}/Defaults")
165-
paths.append(f"/Operations/{self.__vo}/{self.__setup}")
119+
paths.append(f"/Operations/{self.__vo}/")
166120
return paths
167121

168122
def getValue(self, optionPath, defaultValue=None):
@@ -202,26 +156,6 @@ def getOptionsDict(self, sectionPath):
202156
data[opName] = sectionCFG[opName]
203157
return S_OK(data)
204158

205-
def getPath(self, option, vo=False, setup=False):
206-
"""
207-
Generate the CS path for an option:
208-
209-
- if vo is not defined, the helper's vo will be used for multi VO installations
210-
- if setup evaluates False (except None) -> The helpers setup will be used
211-
- if setup is defined -> whatever is defined will be used as setup
212-
- if setup is None -> Defaults will be used
213-
214-
:param option: path with respect to the Operations standard path
215-
:type option: string
216-
"""
217-
218-
for path in self.__getSearchPaths():
219-
optionPath = os.path.join(path, option)
220-
value = gConfig.getValue(optionPath, "NoValue")
221-
if value != "NoValue":
222-
return optionPath
223-
return ""
224-
225159
def getMonitoringBackends(self, monitoringType=None):
226160
"""
227161
Chooses the type of backend to use (Monitoring and/or Accounting) depending on the MonitoringType.

0 commit comments

Comments
 (0)