Author: aconway
Date: Fri Apr 25 19:38:41 2014
New Revision: 1590118
URL: http://svn.apache.org/r1590118
Log:
NO-JIRA: HA qpid-ha usability: automatically use qpidd.conf if no --broker
option.
Modified:
qpid/trunk/qpid/tools/src/py/qpid-ha
Modified: qpid/trunk/qpid/tools/src/py/qpid-ha
URL:
http://svn.apache.org/viewvc/qpid/trunk/qpid/tools/src/py/qpid-ha?rev=1590118&r1=1590117&r2=1590118&view=diff
==============================================================================
--- qpid/trunk/qpid/tools/src/py/qpid-ha (original)
+++ qpid/trunk/qpid/tools/src/py/qpid-ha Fri Apr 25 19:38:41 2014
@@ -41,6 +41,15 @@ class ExitStatus(Exception):
"""Raised if a command want's a non-0 exit status from the script"""
def __init__(self, status): self.status = status
+def find_qpidd_conf():
+ """Return the path to the local qpid.conf file or None if it is not
found"""
+ p = os.path
+ prefix, bin = p.split(p.dirname(__file__))
+ if bin == "bin": # Installed in a standard place.
+ conf = p.join(prefix, "etc", "qpid", "qpidd.conf")
+ if p.isfile(conf): return conf
+ return None
+
class Command:
commands = {}
@@ -65,7 +74,10 @@ class Command:
def connect(self, opts):
conn_options = {}
- if not opts.broker: opts.broker = DEFAULTS["broker"]
+ if not opts.broker:
+ opts.broker = DEFAULTS["broker"]
+ # If we are connecting locally, use local qpidd.conf by default
+ if not opts.config: opts.config = find_qpidd_conf()
url = URL(opts.broker)
if opts.config: # Use broker config file for defaults
config = parse_qpidd_conf(opts.config)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]