You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2012/03/01 00:37:40 UTC

svn commit: r1295337 - in /qpid/trunk/qpid/tools/src/py: qpid-config qpid-ha qpid-route qpid-stat

Author: aconway
Date: Wed Feb 29 23:37:39 2012
New Revision: 1295337

URL: http://svn.apache.org/viewvc?rev=1295337&view=rev
Log:
QPID-3603: Add --ha-admin option to qpid-config, qpid-stat, qpid-route

Allow admin tools to connect to a HA backup broker.

Modified:
    qpid/trunk/qpid/tools/src/py/qpid-config
    qpid/trunk/qpid/tools/src/py/qpid-ha
    qpid/trunk/qpid/tools/src/py/qpid-route
    qpid/trunk/qpid/tools/src/py/qpid-stat

Modified: qpid/trunk/qpid/tools/src/py/qpid-config
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-config?rev=1295337&r1=1295336&r2=1295337&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-config (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-config Wed Feb 29 23:37:39 2012
@@ -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):

Modified: qpid/trunk/qpid/tools/src/py/qpid-ha
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-ha?rev=1295337&r1=1295336&r2=1295337&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-ha (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-ha Wed Feb 29 23:37:39 2012
@@ -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
 

Modified: qpid/trunk/qpid/tools/src/py/qpid-route
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-route?rev=1295337&r1=1295336&r2=1295337&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-route (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-route Wed Feb 29 23:37:39 2012
@@ -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()
 

Modified: qpid/trunk/qpid/tools/src/py/qpid-stat
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-stat?rev=1295337&r1=1295336&r2=1295337&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-stat (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-stat Wed Feb 29 23:37:39 2012
@@ -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):



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org