From 2d41f47988da7be69b5e0b007b1591d8ad66e41f Mon Sep 17 00:00:00 2001 From: Nuno Santos Date: Thu, 8 Sep 2011 20:27:49 +0000 Subject: make 'qpid-config queues/exchanges ' 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 --- tools/src/py/qpid-config | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'tools') 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()) -- cgit v1.2.1