Skip to content

Commit 2a14f6b

Browse files
committed
Bit of refactoring; only run gratia CE checks if we have a CE (SOFTWARE-5115)
1 parent 0223483 commit 2a14f6b

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

osg_configure/configure_modules/gratia.py

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222

2323
CE_PROBE_RPMS = ['gratia-probe-htcondor-ce']
2424

25-
CONDOR_CE_CONFIG_VAL = "/usr/bin/condor_ce_config_val"
26-
2725

2826
def requirements_are_installed():
2927
return (utilities.gateway_installed() and
@@ -246,7 +244,7 @@ def check_attributes(self, attributes):
246244
self.log("GratiaConfiguration.check_attributes completed")
247245
return True
248246
status = self._check_servers()
249-
if 'htcondor-ce' in self._probe_config:
247+
if 'htcondor-ce' in self._probe_config and requirements_are_installed():
250248
status &= self._verify_gratia_dirs_for_htcondor_ce_probe()
251249
self.log("GratiaConfiguration.check_attributes completed")
252250
return status
@@ -441,9 +439,6 @@ def _verify_gratia_dirs_for_htcondor_ce_probe(self) -> bool:
441439
442440
"""
443441

444-
if not os.path.exists(CONDOR_CE_CONFIG_VAL):
445-
raise exceptions.ConfigureError(f"{CONDOR_CE_CONFIG_VAL} missing")
446-
447442
if self.condor_enabled:
448443
history_dir = self._get_condor_history_dir()
449444
condor_name = "Condor"
@@ -494,27 +489,14 @@ def _verify_gratia_dirs_for_htcondor_ce_probe(self) -> bool:
494489
self.logger.error(advice_on_error)
495490
return False
496491

497-
def _get_condor_history_dir(self):
492+
@staticmethod
493+
def _get_condor_history_dir():
498494
history_dir = utilities.get_condor_config_val("PER_JOB_HISTORY_DIR", subsystem="SCHEDD", quiet_undefined=True)
499495
return history_dir
500496

501-
def _get_condor_ce_history_dir(self):
502-
cmd = [CONDOR_CE_CONFIG_VAL, '-subsystem', 'SCHEDD', 'PER_JOB_HISTORY_DIR']
503-
try:
504-
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="latin-1")
505-
history_dir, errtext = process.communicate()
506-
if process.returncode != 0:
507-
self.logger.info("While checking gratia parameters: %s failed. Output follows:\n%s",
508-
CONDOR_CE_CONFIG_VAL, errtext)
509-
return None
510-
except OSError as err:
511-
self.logger.info("While checking gratia parameters: Error running %s: %s",
512-
CONDOR_CE_CONFIG_VAL, err)
513-
return None
514-
history_dir = history_dir.strip()
515-
if history_dir.startswith('Not defined'):
516-
return None
517-
return history_dir
497+
@staticmethod
498+
def _get_condor_ce_history_dir():
499+
return utilities.get_condor_ce_config_val("PER_JOB_HISTORY_DIR", subsystem="SCHEDD", quiet_undefined=True)
518500

519501
@staticmethod
520502
def replace_setting(buf, setting, value, xml_file=True):

0 commit comments

Comments
 (0)