diff options
author | Alan Conway <aconway@apache.org> | 2012-02-29 23:37:39 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2012-02-29 23:37:39 +0000 |
commit | da594b8f8fb8d519b5818114cebc74236a3bbb51 (patch) | |
tree | 942aebd8e66aab5a5288c47327ba1a2b0eeccacb | |
parent | 6c3b6f5e7d1289e14eb5f48d218d4219f6be5501 (diff) | |
download | qpid-python-da594b8f8fb8d519b5818114cebc74236a3bbb51.tar.gz |
QPID-3603: Add --ha-admin option to qpid-config, qpid-stat, qpid-route
Allow admin tools to connect to a HA backup broker.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1295337 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-x | qpid/tools/src/py/qpid-config | 10 | ||||
-rwxr-xr-x | qpid/tools/src/py/qpid-ha | 1 | ||||
-rwxr-xr-x | qpid/tools/src/py/qpid-route | 10 | ||||
-rwxr-xr-x | qpid/tools/src/py/qpid-stat | 8 |
4 files changed, 21 insertions, 8 deletions
diff --git a/qpid/tools/src/py/qpid-config b/qpid/tools/src/py/qpid-config index 007b25af86..ee1c365fbf 100755 --- a/qpid/tools/src/py/qpid-config +++ b/qpid/tools/src/py/qpid-config @@ -70,7 +70,7 @@ Queue Limit Actions: ring - Replace oldest unacquired message with new ring-strict - Replace oldest message, reject if oldest is acquired -Replicate levels: +Replication levels: none - no replication configuration - replicate queue and exchange existence and bindings, but not messages. @@ -88,6 +88,7 @@ class Config: self._altern_ex = None self._durable = False self._replicate = None + self._ha_admin = False self._clusterDurable = False self._if_empty = True self._if_unused = True @@ -185,6 +186,7 @@ def OptionsAndArguments(argv): group2.add_option("--alternate-exchange", action="store", type="string", metavar="<aexname>", help="Name of the alternate-exchange for the new queue or exchange. Exchanges route messages to the alternate exchange if they are unable to route them elsewhere. Queues route messages to the alternate exchange if they are rejected by a subscriber or orphaned by queue deletion.") group2.add_option("--durable", action="store_true", help="The new queue or exchange is durable.") group2.add_option("--replicate", action="store", metavar="<level>", help="Replication level for the new queue or exchange (none, configuration or messages).") + group2.add_option("--ha-admin", action="store_true", help="Allow connection to a HA backup broker.") parser.add_option_group(group2) group3 = OptionGroup(parser, "Options for Adding Queues") @@ -254,6 +256,7 @@ def OptionsAndArguments(argv): if not opts.replicate in REPLICATE_LEVELS: raise Exception("Invalid replicate level '%s', should be one of: %s" % (opts.replicate, ", ".join(REPLICATE_LEVELS))) config._replicate = opts.replicate + if opts.ha_admin: config._ha_admin = True if opts.cluster_durable: config._clusterDurable = True if opts.file: @@ -350,8 +353,9 @@ class BrokerManager: def SetBroker(self, brokerUrl, mechanism): self.url = brokerUrl - self.conn = Connection(self.url, sasl_mechanisms=mechanism) - self.conn.open() + client_properties={} + if config._ha_admin: client_properties["qpid.ha-admin"] = 1 + self.conn = Connection.establish(self.url, sasl_mechanisms=mechanism, client_properties=client_properties) self.broker = BrokerAgent(self.conn) def Disconnect(self): diff --git a/qpid/tools/src/py/qpid-ha b/qpid/tools/src/py/qpid-ha index 90e11fc5ab..a4230b05a6 100755 --- a/qpid/tools/src/py/qpid-ha +++ b/qpid/tools/src/py/qpid-ha @@ -231,7 +231,6 @@ def main(argv): return 1; Command.commands[command[0]].execute(command) except Exception, e: - raise # FIXME aconway 2012-02-23: print e return 1 diff --git a/qpid/tools/src/py/qpid-route b/qpid/tools/src/py/qpid-route index f90416d7b0..0316c24322 100755 --- a/qpid/tools/src/py/qpid-route +++ b/qpid/tools/src/py/qpid-route @@ -62,6 +62,7 @@ class Config: self._ack = 0 self._connTimeout = 10 self._client_sasl_mechanism = None + self._ha_admin = False config = Config() @@ -96,7 +97,7 @@ def OptionsAndArguments(argv): parser.add_option("-t", "--transport", action="store", type="string", default="tcp", metavar="<transport>", help="Transport to use for links, defaults to tcp") parser.add_option("--client-sasl-mechanism", action="store", type="string", metavar="<mech>", help="SASL mechanism for authentication (e.g. EXTERNAL, ANONYMOUS, PLAIN, CRAM-MD, DIGEST-MD5, GSSAPI). Used when the client connects to the destination broker (not for authentication between the source and destination brokers - that is specified using the [mechanisms] argument to 'add route'). SASL automatically picks the most secure available mechanism - use this option to override.") - + parser.add_option("--ha-admin", action="store_true", help="Allow connection to a HA backup broker.") opts, encArgs = parser.parse_args(args=argv) try: @@ -128,6 +129,9 @@ def OptionsAndArguments(argv): if opts.transport: config._transport = opts.transport + if opts.ha_admin: + config._ha_admin = True + if opts.ack: config._ack = opts.ack @@ -143,7 +147,9 @@ class RouteManager: self.local = BrokerURL(localBroker) self.remote = None self.qmf = Session() - self.broker = self.qmf.addBroker(localBroker, config._connTimeout, config._client_sasl_mechanism) + client_properties = {} + if config._ha_admin: client_properties["qpid.ha-admin"] = 1 + self.broker = self.qmf.addBroker(localBroker, config._connTimeout, config._client_sasl_mechanism, client_properties=client_properties) self.broker._waitForStable() self.agent = self.broker.getBrokerAgent() diff --git a/qpid/tools/src/py/qpid-stat b/qpid/tools/src/py/qpid-stat index 8dfcdf5bc2..17e4120f60 100755 --- a/qpid/tools/src/py/qpid-stat +++ b/qpid/tools/src/py/qpid-stat @@ -43,6 +43,7 @@ class Config: self._increasing = False self._sortcol = None self._sasl_mechanism = None + self._ha_admin = False config = Config() @@ -60,6 +61,7 @@ def OptionsAndArguments(argv): help="Maximum time to wait for broker connection (in seconds)") group1.add_option("--sasl-mechanism", action="store", type="string", metavar="<mech>", help="SASL mechanism for authentication (e.g. EXTERNAL, ANONYMOUS, PLAIN, CRAM-MD, DIGEST-MD5, GSSAPI). SASL automatically picks the most secure available mechanism - use this option to override.") + group1.add_option("--ha-admin", action="store_true", help="Allow connection to a HA backup broker.") parser.add_option_group(group1) group2 = OptionGroup(parser, "Display Options") @@ -88,6 +90,7 @@ def OptionsAndArguments(argv): config._increasing = opts.increasing config._limit = opts.limit config._sasl_mechanism = opts.sasl_mechanism + config._ha_admin = opts.ha_admin return args @@ -125,8 +128,9 @@ class BrokerManager: def SetBroker(self, brokerUrl, mechanism): self.url = brokerUrl - self.connection = Connection(self.url, sasl_mechanisms=mechanism) - self.connection.open() + client_properties={} + if config._ha_admin: client_properties["qpid.ha-admin"] = 1 + self.connection = Connection.establish(self.url, sasl_mechanisms=mechanism, client_properties=client_properties) self.broker = BrokerAgent(self.connection) def Disconnect(self): |