diff options
authorJulien Danjou <>2013-07-01 17:29:20 +0200
committerJulien Danjou <>2013-07-04 11:35:15 +0200
commit471686590ae9e0a332781e04a6073c8e32cee31e (patch)
parent085dd69acdd5c8c216271dc8890c4107363190fb (diff)
config.generator: replace sys.prefix by /usr
Nova has some default configuration option (bindir) value that uses sys.prefix as path start. That can generates weird paths depending on the system where you run the configuration generator. This patch fixes that by hardcoding a replacement of sys.prefix to /usr, which is what's actually expected most of the time. Change-Id: Ied3b58695965a3102670e3761701fbe10ac74785 Signed-off-by: Julien Danjou <>
1 files changed, 6 insertions, 1 deletions
diff --git a/openstack/common/config/ b/openstack/common/config/
index 8ebfba1..0dd7c97 100755
--- a/openstack/common/config/
+++ b/openstack/common/config/
@@ -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, '')