Skip to content

Commit 698a1ac

Browse files
committed
Drop usage of lcmaps / misc.py
1 parent dd6e64c commit 698a1ac

File tree

8 files changed

+15
-188
lines changed

8 files changed

+15
-188
lines changed

osg_configure/configure_modules/infoservices.py

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,10 @@
22
for CE collector info services"""
33

44
import re
5-
import os
6-
try:
7-
import ConfigParser
8-
except ImportError:
9-
import configparser as ConfigParser
5+
import configparser as ConfigParser
106
import subprocess
117
import logging
128

13-
from osg_configure.configure_modules.misc import MiscConfiguration
149
from osg_configure.modules import exceptions
1510
from osg_configure.modules import utilities
1611
from osg_configure.modules import configfile
@@ -67,7 +62,6 @@ def __init__(self, *args, **kwargs):
6762
self.resource_catalog = None
6863
self.authorization_method = None
6964
self.subcluster_sections = None
70-
self.misc_module = MiscConfiguration(*args, **kwargs)
7165

7266
self.log("InfoServicesConfiguration.__init__ completed")
7367

@@ -119,8 +113,6 @@ def parse_configuration(self, configuration):
119113

120114
self.ce_collectors = self._parse_ce_collectors(self.options['ce_collectors'].value)
121115

122-
self.misc_module.parse_configuration(configuration)
123-
124116
def csg(section, option):
125117
return utilities.config_safe_get(configuration, section, option, None)
126118

@@ -135,7 +127,6 @@ def csgbool(section, option):
135127

136128
self.htcondor_gateway_enabled = csgbool('Gateway', 'htcondor_gateway_enabled')
137129

138-
self.authorization_method = csg('Misc Services', 'authorization_method')
139130
self.subcluster_sections = ConfigParser.SafeConfigParser()
140131

141132
for section in configuration.sections():
@@ -156,7 +147,7 @@ def csgbool(section, option):
156147
# configure(), but at this point we don't have a way of knowing what
157148
# default_allowed_vos should be.
158149
if self.ce_collector_required_rpms_installed and self.htcondor_gateway_enabled and classad is not None:
159-
subcluster.resource_catalog_from_config(self.subcluster_sections, default_allowed_vos=None)
150+
subcluster.resource_catalog_from_config(self.subcluster_sections, default_allowed_vos=["*"])
160151

161152
self.log('InfoServicesConfiguration.parse_configuration completed')
162153

@@ -184,44 +175,11 @@ def configure(self, attributes):
184175
"\nIf not, you may need to add the directory containing the Python bindings to PYTHONPATH."
185176
"\nHTCondor version must be at least 8.2.0.", level=logging.WARNING)
186177
else:
187-
if self.authorization_method == 'vomsmap':
188-
error = False
189-
for requiredfile in [BAN_MAPFILE, BAN_VOMS_MAPFILE]:
190-
if not os.path.exists(requiredfile):
191-
self.log("%s authorization requested but %s was not found."
192-
"\nThis will cause all mappings to fail."
193-
"\nPlease reinstall lcmaps >= 1.6.6-1.3 or create a blank %s yourself." %
194-
(self.authorization_method, requiredfile, requiredfile),
195-
level=logging.ERROR)
196-
error = True
197-
if error:
198-
return False
199-
200-
default_allowed_vos = list(reversevomap.get_allowed_vos())
201-
else:
202-
default_allowed_vos = []
203-
if not default_allowed_vos:
204-
# UGLY: only issue the warning if the admin has requested autodetection for some of their SCs/REs
205-
raise_warning = False
206-
for section in self.subcluster_sections.sections():
207-
if utilities.config_safe_get(self.subcluster_sections, section, 'allowed_vos', '').strip() == "*":
208-
raise_warning = True
209-
if raise_warning:
210-
self.log("Could not determine default allowed VOs for subclusters/resource entries.",
211-
level=logging.WARNING)
212-
if self.authorization_method == 'vomsmap':
213-
self.log("Install vo-client-lcmaps-voms to obtain default mappings for VOs, and/or create"
214-
" your own mapfile at /etc/grid-security/voms-mapfile.",
215-
level=logging.WARNING)
216-
else:
217-
self.log("Ensure %s exists and is non-empty, or fill out allowed_vos in all your"
218-
" Subcluster and Resource Entry sections." % USER_VO_MAP_LOCATION,
219-
level=logging.WARNING)
220178
try:
221-
self.resource_catalog = subcluster.resource_catalog_from_config(self.subcluster_sections,
222-
default_allowed_vos=default_allowed_vos)
179+
self.resource_catalog = subcluster.resource_catalog_from_config(
180+
self.subcluster_sections, default_allowed_vos=["*"])
223181
except exceptions.SettingError as err:
224-
self.log("Error in info services configuration: %s" % str(err), level=logging.ERROR)
182+
self.log("Error in info services configuration: %s" % err, level=logging.ERROR)
225183
return False
226184
self._configure_ce_collector()
227185

osg_configure/modules/subcluster.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import logging
22
import re
3-
from typing import Optional
3+
import textwrap
4+
from typing import List, Optional
45
from configparser import NoSectionError, NoOptionError, InterpolationError, ConfigParser
56

67
from osg_configure.modules import exceptions
@@ -228,7 +229,7 @@ def compose_text(self) -> str:
228229
pass
229230

230231

231-
def resource_catalog_from_config(config: ConfigParser, default_allowed_vos: str = None) -> ResourceCatalog:
232+
def resource_catalog_from_config(config: ConfigParser, default_allowed_vos: List[str] = None) -> ResourceCatalog:
232233
"""
233234
Create a ResourceCatalog from the subcluster entries in a config
234235
:param default_allowed_vos: The allowed_vos to use if the user specified "*"
@@ -275,10 +276,13 @@ def safegetbool(option: str, default=None) -> bool:
275276

276277
rcentry.allowed_vos = utilities.split_comma_separated_list(safeget("allowed_vos", default="").strip())
277278
if not rcentry.allowed_vos or not rcentry.allowed_vos[0]:
278-
logger.error("No allowed_vos specified for section '%s'."
279-
"\nThe factory will not send jobs to these subclusters/resources. Specify the allowed_vos"
280-
"\nattribute as either a list of VOs, or a '*' to use an autodetected VO list based on"
281-
"\nthe user accounts available on your CE." % section)
279+
# TODO #1 Is this really where the error should be?
280+
# TODO #2 The autodetected bit is not currently true...
281+
logger.error(
282+
textwrap.fill(
283+
"""No allowed_vos specified for section '%s'. Specify the allowed_vos
284+
attribute as either a list of VOs, or a '*' to use an autodetected VO list based on
285+
the user accounts available on your CE.""" % section))
282286
raise exceptions.SettingError("No allowed_vos for %s" % section)
283287
if rcentry.allowed_vos == ["*"]:
284288
if default_allowed_vos:

tests/configs/misc/invalid_settings1.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/configs/misc/misc1.ini

Lines changed: 0 additions & 3 deletions
This file was deleted.

tests/configs/misc/misc_gridmap.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/configs/misc/misc_local_gridmap.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/configs/misc/valid_settings2.ini

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/test_misc.py

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)