diff options
| author | Alan Conway <aconway@apache.org> | 2014-04-25 19:38:41 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2014-04-25 19:38:41 +0000 |
| commit | 32dae54e851da9b5e5608ce1b7d46ac2b7ad2d96 (patch) | |
| tree | 75392535bc565cb11cb4df3f18a8b492596ab70a | |
| parent | d7e809e0817fe778b901a3d4a07e00aea6c20201 (diff) | |
| download | qpid-python-32dae54e851da9b5e5608ce1b7d46ac2b7ad2d96.tar.gz | |
NO-JIRA: HA qpid-ha usability: automatically use qpidd.conf if no --broker option.
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1590118 13f79535-47bb-0310-9956-ffa450edef68
| -rwxr-xr-x | qpid/tools/src/py/qpid-ha | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/qpid/tools/src/py/qpid-ha b/qpid/tools/src/py/qpid-ha index 300b53598e..50a80c59c9 100755 --- a/qpid/tools/src/py/qpid-ha +++ b/qpid/tools/src/py/qpid-ha @@ -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) |
