diff --git a/src/scripts/blah.py b/src/scripts/blah.py index d0f9bea4..679add99 100644 --- a/src/scripts/blah.py +++ b/src/scripts/blah.py @@ -22,5 +22,8 @@ def items(self): return super(BlahConfigParser, self).items(self.header) def get(self, option): - return super(BlahConfigParser, self).get(self.header, option) + # ConfigParser happily includes quotes in value strings, which we + # happily allow in /etc/blah.config. This causes failures when joining + # paths, for example. + return super(BlahConfigParser, self).get(self.header, option).strip('"\'') diff --git a/src/scripts/pbs_status.py b/src/scripts/pbs_status.py index 044904bc..01664f70 100755 --- a/src/scripts/pbs_status.py +++ b/src/scripts/pbs_status.py @@ -357,15 +357,17 @@ def get_qstat_location(): global _qstat_location_cache if _qstat_location_cache != None: return _qstat_location_cache + try: - cmd = os.path.join(config.get('pbs_binpath'), 'qstat') + location = os.path.join(config.get('pbs_binpath'), 'qstat') except KeyError: cmd = 'which qstat' - child_stdout = os.popen(cmd) - output = child_stdout.read() - location = output.split("\n")[0].strip() - if child_stdout.close(): - raise Exception("Unable to determine qstat location: %s" % output) + child_stdout = os.popen(cmd) + output = child_stdout.read() + location = output.split("\n")[0].strip() + if child_stdout.close(): + raise Exception("Unable to determine qstat location: %s" % output) + _qstat_location_cache = location return location diff --git a/src/scripts/slurm_status.py b/src/scripts/slurm_status.py index 8fb9e553..b462a298 100644 --- a/src/scripts/slurm_status.py +++ b/src/scripts/slurm_status.py @@ -336,14 +336,15 @@ def get_slurm_location(program): if _slurm_location_cache != None: return os.path.join(_slurm_location_cache, program) try: - cmd = os.path.join(config.get('slurm_binpath'), program) + location = os.path.join(config.get('slurm_binpath'), program) except KeyError: cmd = 'which %s' % program - child_stdout = os.popen(cmd) - output = child_stdout.read() - location = output.split("\n")[0].strip() - if child_stdout.close(): - raise Exception("Unable to determine scontrol location: %s" % output) + child_stdout = os.popen(cmd) + output = child_stdout.read() + location = output.split("\n")[0].strip() + if child_stdout.close(): + raise Exception("Unable to determine scontrol location: %s" % output) + _slurm_location_cache = os.path.dirname(location) return location