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

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Sat Feb 9 13:09:06 EST 2008


Author: justi9
Date: 2008-02-09 13:09:06 -0500 (Sat, 09 Feb 2008)
New Revision: 1669

Modified:
   mgmt/cumin/python/cumin/util.py
Log:
Add a function to parse a broker address string.

Stop using non existent exception classes.



Modified: mgmt/cumin/python/cumin/util.py
===================================================================
--- mgmt/cumin/python/cumin/util.py	2008-02-09 18:07:59 UTC (rev 1668)
+++ mgmt/cumin/python/cumin/util.py	2008-02-09 18:09:06 UTC (rev 1669)
@@ -23,6 +23,16 @@
     if dt is not None:
         return mktime(dt.timetuple())
 
+def parse_broker_addr(string):
+    addr = string.split(":")
+
+    if len(addr) > 1:
+        host, port = addr[0], int(addr[1])
+    else:
+        host, port = addr[0], 5672
+
+    return host, port
+
 class Identifiable(object):
     def __init__(self, id=None):
         self.id = id
@@ -53,13 +63,13 @@
         elif type == "s":
             value = string
         else:
-            raise Error("Invalid type '%s'" % type)
+            raise Exception("Invalid type '%s'" % type)
 
         return value
 
     def get(self, name):
         if name not in self.__params:
-            raise Error("Parameter '%s' not found" % name)
+            raise Exception("Parameter '%s' not found" % name)
 
         type, default = self.__param_specs[name]
 




More information about the rhmessaging-commits mailing list