summaryrefslogtreecommitdiffstats
path: root/openstack/common/config/generator.py
diff options
context:
space:
mode:
Diffstat (limited to 'openstack/common/config/generator.py')
-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, '')