summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2013-07-06 01:41:43 +0000
committerGerrit Code Review <review@openstack.org>2013-07-06 01:41:43 +0000
commita9def1ef8ddee3c5cab9b603d1433902036c5260 (patch)
tree109bb39b194ecaabebbee03421987c16ffab76d2
parent6a4800d86ae94123875d510f4f9a7967f09d93cf (diff)
parent471686590ae9e0a332781e04a6073c8e32cee31e (diff)
downloadoslo-a9def1ef8ddee3c5cab9b603d1433902036c5260.zip
oslo-a9def1ef8ddee3c5cab9b603d1433902036c5260.tar.gz
oslo-a9def1ef8ddee3c5cab9b603d1433902036c5260.tar.xz
Merge "config.generator: replace sys.prefix by /usr"
-rwxr-xr-xopenstack/common/config/generator.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/openstack/common/config/generator.py b/openstack/common/config/generator.py
index 8ebfba1..0dd7c97 100755
--- a/openstack/common/config/generator.py
+++ b/openstack/common/config/generator.py
@@ -188,7 +188,12 @@ def _get_my_ip():
def _sanitize_default(s):
"""Set up a reasonably sensible default for pybasedir, my_ip and host."""
- if s.startswith(BASEDIR):
+ if s.startswith(sys.prefix):
+ # NOTE(jd) Don't use os.path.join, because it is likely to think the
+ # second part is an absolute pathname and therefore drop the first
+ # part.
+ s = os.path.normpath("/usr/" + s[len(sys.prefix):])
+ elif s.startswith(BASEDIR):
return s.replace(BASEDIR, '/usr/lib/python/site-packages')
elif BASEDIR in s:
return s.replace(BASEDIR, '')