summaryrefslogtreecommitdiff
path: root/qpid/tools/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2014-05-01 22:20:26 +0000
committerAlan Conway <aconway@apache.org>2014-05-01 22:20:26 +0000
commite57cd3393b842e40f9da989ab4d60142682ba73e (patch)
tree60cca2b0edc4c7aaa9645f8c5a8dd879bff3eb79 /qpid/tools/src
parent7c0d7cd95d3cbf691e5d0e39be3fe10dce340040 (diff)
downloadqpid-python-e57cd3393b842e40f9da989ab4d60142682ba73e.tar.gz
NO-JIRA: HA fix hanging ha_tests.test_failover_send_receive on RHEL5
The test was hanging because of a python construct not available in 2.4. It was causing an exception in a strange place because this bit of code was imported at runtime, and that was hanging the test. Fixed and did some cleanup to avoid such mysterious hangs in future: - Fixed qpidtoollibs/config.py to work with python 2.4. - Import qpid-ha script at import time rather than runtime. - Fix Popen.teardown logic to avoid hanging if a process can't be killed. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1591794 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/tools/src')
-rw-r--r--qpid/tools/src/py/qpidtoollibs/config.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/qpid/tools/src/py/qpidtoollibs/config.py b/qpid/tools/src/py/qpidtoollibs/config.py
index 328c132a5c..9168215ac3 100644
--- a/qpid/tools/src/py/qpidtoollibs/config.py
+++ b/qpid/tools/src/py/qpidtoollibs/config.py
@@ -24,10 +24,12 @@ QPID_ENV_PREFIX="QPID_"
def parse_qpidd_conf(config_file):
"""Parse a qpidd.conf configuration file into a dictionary"""
- with open(config_file) as f:
+ f = open(config_file)
+ try:
clean = filter(None, [line.split("#")[0].strip() for line in f]) # Strip comments and blanks
def item(line): return [x.strip() for x in line.split("=")]
config = dict(item(line) for line in clean if "=" in line)
+ finally: f.close()
def name(env_name): return env_name[len(QPID_ENV_PREFIX):].lower()
env = dict((name(i[0]), i[1]) for i in os.environ.iteritems() if i[0].startswith(QPID_ENV_PREFIX))
config.update(env) # Environment takes precedence