r5413 - trunk/cumin/python/cumin
tmckay at fedoraproject.org
tmckay at fedoraproject.org
Thu Jun 14 15:39:26 UTC 2012
Author: tmckay
Date: 2012-06-14 15:39:26 +0000 (Thu, 14 Jun 2012)
New Revision: 5413
Modified:
trunk/cumin/python/cumin/config.py
Log:
Allow $CUMIN_HOME as part of a string in cumin.conf parameter values.
$CUMIN_HOME will be replaced with the resolved path before the configuration
values are passed back.
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2012-06-13 19:38:27 UTC (rev 5412)
+++ trunk/cumin/python/cumin/config.py 2012-06-14 15:39:26 UTC (rev 5413)
@@ -40,7 +40,14 @@
paths.append(os.path.join(self.home, "etc", "cumin.conf"))
paths.append(os.path.join(os.path.expanduser("~"), ".cumin.conf"))
- return self.parse_files(paths)
+ # If config values reference $CUMIN_HOME, replace with the
+ # resolved value
+ vals = self.parse_files(paths)
+ for sect_key, sect_vals in vals.iteritems():
+ for param, value in sect_vals.iteritems():
+ if type(value) is str and "$CUMIN_HOME" in value:
+ sect_vals[param] = value.replace("$CUMIN_HOME", self.home)
+ return vals
class CuminCommonConfig(CuminConfig):
'''
More information about the cumin-developers
mailing list