Return-Path: Delivered-To: apmail-incubator-qpid-commits-archive@locus.apache.org Received: (qmail 73816 invoked from network); 20 Oct 2008 15:27:59 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Oct 2008 15:27:59 -0000 Received: (qmail 55231 invoked by uid 500); 20 Oct 2008 15:28:01 -0000 Delivered-To: apmail-incubator-qpid-commits-archive@incubator.apache.org Received: (qmail 55223 invoked by uid 500); 20 Oct 2008 15:28:01 -0000 Mailing-List: contact qpid-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: qpid-dev@incubator.apache.org Delivered-To: mailing list qpid-commits@incubator.apache.org Received: (qmail 55208 invoked by uid 99); 20 Oct 2008 15:28:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Oct 2008 08:28:01 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Oct 2008 15:26:59 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 3DED0238889D; Mon, 20 Oct 2008 08:27:38 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r706320 - in /incubator/qpid/trunk/qpid/python: commands/qpid-route qpid/qmfconsole.py Date: Mon, 20 Oct 2008 15:27:38 -0000 To: qpid-commits@incubator.apache.org From: gsim@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081020152738.3DED0238889D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: gsim Date: Mon Oct 20 08:27:37 2008 New Revision: 706320 URL: http://svn.apache.org/viewvc?rev=706320&view=rev Log: Allow transport to be set on qpid-route. Modified: incubator/qpid/trunk/qpid/python/commands/qpid-route incubator/qpid/trunk/qpid/python/qpid/qmfconsole.py Modified: incubator/qpid/trunk/qpid/python/commands/qpid-route URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/commands/qpid-route?rev=706320&r1=706319&r2=706320&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/commands/qpid-route (original) +++ incubator/qpid/trunk/qpid/python/commands/qpid-route Mon Oct 20 08:27:37 2008 @@ -40,6 +40,8 @@ print " -q [ --quiet ] Quiet output, don't print duplicate warnings" print " -d [ --durable ] Added configuration shall be durable" print " -e [ --del-empty-link ] Delete link after deleting last route on the link" + print " -t [ --transport ]" + print " Specify transport to use for links, defaults to tcp" print print " dest-broker and src-broker are in the form: [username/password@] hostname | ip-address [:]" print " ex: localhost, 10.1.1.7:10000, broker-host:10000, guest/guest@localhost" @@ -65,13 +67,13 @@ def getLink (self): links = self.qmf.getObjects(_class="link") for link in links: - if "%s:%d" % (link.host, link.port) == self.src.name (): + if self.src.match(link.host, link.port): return link return None def AddLink (self, srcBroker): self.src = qmfconsole.BrokerURL(srcBroker) - if self.dest.name() == self.src.name(): + if self.dest.match(self.src.host, self.src.port): print "Linking broker to itself is not permitted" sys.exit(1) @@ -118,7 +120,7 @@ def AddRoute (self, srcBroker, exchange, routingKey, tag, excludes): self.src = qmfconsole.BrokerURL(srcBroker) - if self.dest.name() == self.src.name(): + if self.dest.match(self.src.host, self.src.port): raise Exception("Linking broker to itself is not permitted") brokers = self.qmf.getObjects(_class="broker") @@ -241,8 +243,8 @@ ## try: - longOpts = ("verbose", "quiet", "durable", "del-empty-link") - (optlist, cargs) = getopt.gnu_getopt (sys.argv[1:], "vqde", longOpts) + longOpts = ("verbose", "quiet", "durable", "del-empty-link", "transport=") + (optlist, cargs) = getopt.gnu_getopt (sys.argv[1:], "vqdet:", longOpts) except: Usage () @@ -255,6 +257,8 @@ _durable = True if opt[0] == "-e" or opt[0] == "--del-empty-link": _dellink = True + if opt[0] == "-t" or opt[0] == "--transport": + _transport = opt[1] nargs = len (cargs) if nargs < 2: @@ -304,7 +308,7 @@ else: Usage () except Exception,e: - print "Failed:", e.message + print "Failed:", e.args[0] sys.exit(1) rm.Disconnect () Modified: incubator/qpid/trunk/qpid/python/qpid/qmfconsole.py URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/python/qpid/qmfconsole.py?rev=706320&r1=706319&r2=706320&view=diff ============================================================================== --- incubator/qpid/trunk/qpid/python/qpid/qmfconsole.py (original) +++ incubator/qpid/trunk/qpid/python/qpid/qmfconsole.py Mon Oct 20 08:27:37 2008 @@ -91,7 +91,8 @@ if not match: raise ValueError("'%s' is not a valid broker url" % (text)) user, password, host, port = match.groups() - self.host = socket.gethostbyname(host) + socket.gethostbyname(host) + self.host = host if port: self.port = int(port) else: self.port = 5672 self.authName = user or "guest" @@ -101,6 +102,9 @@ def name(self): return self.host + ":" + str(self.port) + def match(self, host, port): + return socket.gethostbyname(self.host) == socket.gethostbyname(host) and self.port == port + class Session: """ An instance of the Session class represents a console session running @@ -784,8 +788,8 @@ self.first = first self.second = second - def __cmp__(self, other): - if other == None: + def __cmp__(self, other): + if other == None or not isinstance(other, ObjectId) : return 1 if self.first < other.first: return -1