Author: justi9
Date: 2010-07-30 10:00:13 -0400 (Fri, 30 Jul 2010)
New Revision: 4172
Modified:
mgmt/newdata/cumin/bin/cumin-admin
mgmt/newdata/cumin/bin/cumin-data
mgmt/newdata/cumin/bin/cumin-web
mgmt/newdata/cumin/etc/cumin.conf
mgmt/newdata/cumin/instance/etc/cumin.conf
mgmt/newdata/cumin/python/cumin/config.py
mgmt/newdata/cumin/python/cumin/main.py
mgmt/newdata/cumin/python/cumin/session.py
mgmt/newdata/mint/python/mint/main.py
mgmt/newdata/mint/python/mint/session.py
Log:
Switch from single broker config to multiple brokers; the --brokers parameter now accepts
a comma-separated list of uris
Modified: mgmt/newdata/cumin/bin/cumin-admin
===================================================================
--- mgmt/newdata/cumin/bin/cumin-admin 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/cumin/bin/cumin-admin 2010-07-30 14:00:13 UTC (rev 4172)
@@ -36,8 +36,10 @@
print "Command '%s' is unknown" % name
sys.exit(1)
- app = Cumin(config.home, opts.broker, opts.database)
+ broker_uris = [x.strip() for x in opts.brokers.split(",")]
+ app = Cumin(config.home, broker_uris, opts.database)
+
app.check()
app.init()
Modified: mgmt/newdata/cumin/bin/cumin-data
===================================================================
--- mgmt/newdata/cumin/bin/cumin-data 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/cumin/bin/cumin-data 2010-07-30 14:00:13 UTC (rev 4172)
@@ -24,7 +24,9 @@
model_dir = os.path.join(config.home, "model")
- mint = Mint(model_dir, opts.broker, opts.database)
+ broker_uris = [x.strip() for x in opts.brokers.split(",")]
+
+ mint = Mint(model_dir, broker_uris, opts.database)
mint.print_event_level = opts.print_events
mint.check()
Modified: mgmt/newdata/cumin/bin/cumin-web
===================================================================
--- mgmt/newdata/cumin/bin/cumin-web 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/cumin/bin/cumin-web 2010-07-30 14:00:13 UTC (rev 4172)
@@ -23,7 +23,9 @@
setup_logging(opts)
- cumin = Cumin(config.home, opts.broker, opts.database,
+ broker_uris = [x.strip() for x in opts.brokers.split(",")]
+
+ cumin = Cumin(config.home, broker_uris, opts.database,
opts.host, opts.port)
cumin.debug = opts.debug
Modified: mgmt/newdata/cumin/etc/cumin.conf
===================================================================
--- mgmt/newdata/cumin/etc/cumin.conf 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/cumin/etc/cumin.conf 2010-07-30 14:00:13 UTC (rev 4172)
@@ -2,7 +2,7 @@
[common]
# database: dbname=cumin user=cumin host=localhost
-# broker: localhost:5672
+# brokers: localhost:5672
# log-level: info
[web]
Modified: mgmt/newdata/cumin/instance/etc/cumin.conf
===================================================================
--- mgmt/newdata/cumin/instance/etc/cumin.conf 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/cumin/instance/etc/cumin.conf 2010-07-30 14:00:13 UTC (rev 4172)
@@ -1,6 +1,6 @@
[common]
# database: dbname=cumin user=cumin host=localhost
-# broker: localhost:5672
+# brokers: localhost:5672
# debug: False
[web]
Modified: mgmt/newdata/cumin/python/cumin/config.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/config.py 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/cumin/python/cumin/config.py 2010-07-30 14:00:13 UTC (rev 4172)
@@ -57,7 +57,7 @@
param = ConfigParameter(self, "database", str)
param.default = "dbname=cumin user=cumin host=localhost"
- param = ConfigParameter(self, "broker", str)
+ param = ConfigParameter(self, "brokers", str)
param.default = "amqp://localhost"
self.log_file = ConfigParameter(self, "log-file", str)
@@ -73,7 +73,7 @@
OptionParser.__init__(self)
self.add_option("--database", default=section.database)
- self.add_option("--broker", default=section.broker)
+ self.add_option("--brokers", default=section.brokers)
self.add_option("--log-file", default=section.log_file)
self.add_option("--log-level", default=section.log_level)
self.add_option("--debug", action="store_true",
default=section.debug)
Modified: mgmt/newdata/cumin/python/cumin/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/main.py 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/cumin/python/cumin/main.py 2010-07-30 14:00:13 UTC (rev 4172)
@@ -28,7 +28,7 @@
log = logging.getLogger("cumin")
class Cumin(Application):
- def __init__(self, home, broker_uri, database_dsn,
+ def __init__(self, home, broker_uris, database_dsn,
host="localhost", port=45672):
super(Cumin, self).__init__()
@@ -37,7 +37,7 @@
model_dir = os.path.join(self.home, "model")
self.model = CuminModel(self, model_dir)
- self.session = CuminSession(self, broker_uri)
+ self.session = CuminSession(self, broker_uris)
self.database = CuminDatabase(self, database_dsn)
self.server = CuminServer(self, host, port)
self.admin = CuminAdmin(self)
Modified: mgmt/newdata/cumin/python/cumin/session.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/session.py 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/cumin/python/cumin/session.py 2010-07-30 14:00:13 UTC (rev 4172)
@@ -6,9 +6,9 @@
log = logging.getLogger("cumin.session")
class CuminSession(object):
- def __init__(self, app, broker_uri):
+ def __init__(self, app, broker_uris):
self.app = app
- self.broker_uri = broker_uri
+ self.broker_uris = broker_uris
self.qmf_session = None
self.qmf_brokers = list()
@@ -45,7 +45,8 @@
rcvEvents=False,
rcvHeartbeats=False)
- self.add_broker(self.broker_uri)
+ for uri in self.broker_uris:
+ self.add_broker(uri)
def stop(self):
log.info("Stopping %s", self)
@@ -97,7 +98,7 @@
self.lock.release()
def __repr__(self):
- return "%s(%s)" % (self.__class__.__name__, self.broker_uri)
+ return "%s(%s)" % (self.__class__.__name__, self.broker_uris)
class CuminConsole(Console):
def __init__(self, session):
Modified: mgmt/newdata/mint/python/mint/main.py
===================================================================
--- mgmt/newdata/mint/python/mint/main.py 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/mint/python/mint/main.py 2010-07-30 14:00:13 UTC (rev 4172)
@@ -10,11 +10,11 @@
log = logging.getLogger("mint.main")
class Mint(object):
- def __init__(self, model_dir, broker_uri, database_dsn):
+ def __init__(self, model_dir, broker_uris, database_dsn):
self.model = MintModel(self, model_dir)
self.model.sql_logging_enabled = False
- self.session = MintSession(self, broker_uri)
+ self.session = MintSession(self, broker_uris)
self.database = MintDatabase(self, database_dsn)
self.update_enabled = True
Modified: mgmt/newdata/mint/python/mint/session.py
===================================================================
--- mgmt/newdata/mint/python/mint/session.py 2010-07-29 20:16:20 UTC (rev 4171)
+++ mgmt/newdata/mint/python/mint/session.py 2010-07-30 14:00:13 UTC (rev 4172)
@@ -6,9 +6,9 @@
log = logging.getLogger("mint.session")
class MintSession(object):
- def __init__(self, app, broker_uri):
+ def __init__(self, app, broker_uris):
self.app = app
- self.broker_uri = broker_uri
+ self.broker_uris = broker_uris
self.qmf_session = None
self.qmf_brokers = list()
@@ -46,7 +46,8 @@
#for pkg in self.app.model._packages:
# self.qmf_session.bindPackage(pkg._name)
- self.add_broker(self.broker_uri)
+ for uri in self.broker_uris:
+ self.add_broker(uri)
def stop(self):
log.info("Stopping %s", self)
@@ -55,7 +56,7 @@
self.qmf_session.delBroker(qmf_broker)
def __repr__(self):
- return "%s(%s)" % (self.__class__.__name__, self.broker_uri)
+ return "%s(%s)" % (self.__class__.__name__, self.broker_uris)
class MintConsole(Console):
def __init__(self, model):