You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ns...@apache.org on 2011/09/08 22:27:50 UTC
svn commit: r1166888 - /qpid/trunk/qpid/tools/src/py/qpid-config
Author: nsantos
Date: Thu Sep 8 20:27:49 2011
New Revision: 1166888
URL: http://svn.apache.org/viewvc?rev=1166888&view=rev
Log:
make 'qpid-config queues/exchanges <queue/exchange_name>' return proper error code, for scripting purposes
Modified:
qpid/trunk/qpid/tools/src/py/qpid-config
Modified: qpid/trunk/qpid/tools/src/py/qpid-config
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-config?rev=1166888&r1=1166887&r2=1166888&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-config (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-config Thu Sep 8 20:27:49 2011
@@ -102,6 +102,7 @@ class Config:
self._flowStopSize = None
self._flowResumeSize = None
self._extra_arguments = []
+ self._returnCode = 0
config = Config()
@@ -359,9 +360,16 @@ class BrokerManager:
caption1 = "Type "
caption2 = "Exchange Name"
maxNameLen = len(caption2)
+ found = False
for ex in exchanges:
if self.match(ex.name, filter):
if len(ex.name) > maxNameLen: maxNameLen = len(ex.name)
+ found = True
+ if not found:
+ global config
+ config._returnCode = 1
+ return
+
print "%s%-*s Attributes" % (caption1, maxNameLen, caption2)
line = ""
for i in range(((maxNameLen + len(caption1)) / 5) + 5):
@@ -398,12 +406,18 @@ class BrokerManager:
def QueueList(self, filter):
queues = self.qmf.getObjects(_class="queue", _agent=self.brokerAgent)
-
caption = "Queue Name"
maxNameLen = len(caption)
+ found = False
for q in queues:
if self.match(q.name, filter):
if len(q.name) > maxNameLen: maxNameLen = len(q.name)
+ found = True
+ if not found:
+ global config
+ config._returnCode = 1
+ return
+
print "%-*s Attributes" % (maxNameLen, caption)
line = ""
for i in range((maxNameLen / 5) + 5):
@@ -675,7 +689,7 @@ def main(argv=None):
print "Failed: %s: %s" % (e.__class__.__name__, e)
return 1
- return 0
+ return config._returnCode
if __name__ == "__main__":
sys.exit(main())
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org