[rhmessaging-commits] rhmessaging commits: r2138 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Jun 5 18:22:38 EDT 2008


Author: justi9
Date: 2008-06-05 18:22:38 -0400 (Thu, 05 Jun 2008)
New Revision: 2138

Modified:
   mgmt/cumin/python/cumin/__init__.py
   mgmt/cumin/python/cumin/util.py
Log:
Rename log to log-file to make room for future logging enhancements

Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py	2008-06-05 22:07:06 UTC (rev 2137)
+++ mgmt/cumin/python/cumin/__init__.py	2008-06-05 22:22:38 UTC (rev 2138)
@@ -161,7 +161,7 @@
 
         lpath = os.path.join(self.home, "log", "cumin.log")
         summ = ("PATH", "Log to file at PATH")
-        self.add_param("log",  str, lpath, summ)
+        self.add_param("log-file",  str, lpath, summ)
 
         summ = "Enable debug mode"
         self.add_param("debug", bool, False, summ)
@@ -185,7 +185,7 @@
             root.addHandler(h)
 
         try:
-            h = logging.FileHandler(self.log)
+            h = logging.FileHandler(self.log_file)
         except IOError, e:
             root.warn("Can't write to log file '%s': %s" % (self.log, e))
 

Modified: mgmt/cumin/python/cumin/util.py
===================================================================
--- mgmt/cumin/python/cumin/util.py	2008-06-05 22:07:06 UTC (rev 2137)
+++ mgmt/cumin/python/cumin/util.py	2008-06-05 22:22:38 UTC (rev 2138)
@@ -65,10 +65,12 @@
 
     def load_defaults(self):
         for param in self.__params:
-            if hasattr(self, param.name):
+            name = param.name.replace("-", "_")
+
+            if hasattr(self, name):
                 raise Exception("Parameter '%s' already present" % name)
 
-            setattr(self, param.name, param.default)
+            setattr(self, name, param.default)
 
     def load_file(self, file):
         conf = SafeConfigParser()
@@ -139,7 +141,7 @@
         print "Configuration:"
 
         for param in self.__params:
-            value = getattr(self, param.name)
+            value = getattr(self, param.name.replace("-", "_"))
 
             if value == param.default:
                 flag = " [default]"




More information about the rhmessaging-commits mailing list