summaryrefslogtreecommitdiff
path: root/tools/src
diff options
context:
space:
mode:
authorNuno Santos <nsantos@apache.org>2011-09-08 20:27:49 +0000
committerNuno Santos <nsantos@apache.org>2011-09-08 20:27:49 +0000
commit2d41f47988da7be69b5e0b007b1591d8ad66e41f (patch)
treec8ef21547232aa642b5a65007be3f1b4e6104f51 /tools/src
parentcbc8f2fbbf26d09191d98c034e9cefe81133c129 (diff)
downloadqpid-python-2d41f47988da7be69b5e0b007b1591d8ad66e41f.tar.gz
make 'qpid-config queues/exchanges <queue/exchange_name>' return proper error code, for scripting purposes
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1166888 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'tools/src')
-rwxr-xr-xtools/src/py/qpid-config18
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/src/py/qpid-config b/tools/src/py/qpid-config
index 3430eb6469..63fe66da67 100755
--- a/tools/src/py/qpid-config
+++ b/tools/src/py/qpid-config
@@ -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())