Fix jeos_path when not intalled as an egg
Also use os.path.join() to sort out trailing "/" Change-Id: I212cffacc018f456894e9b7921fef75256edcf45 Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
a16a8bb9c2
commit
07018fe88a
11
bin/heat
11
bin/heat
|
@ -23,6 +23,7 @@ API server.
|
||||||
import gettext
|
import gettext
|
||||||
import optparse
|
import optparse
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import json
|
import json
|
||||||
|
@ -34,15 +35,19 @@ from urlparse import urlparse
|
||||||
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
|
||||||
os.pardir,
|
os.pardir,
|
||||||
os.pardir))
|
os.pardir))
|
||||||
|
jeos_path = ''
|
||||||
|
cfntools_path = ''
|
||||||
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
|
if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
|
||||||
sys.path.insert(0, possible_topdir)
|
sys.path.insert(0, possible_topdir)
|
||||||
jeos_path = '%s/heat/%s/' % (possible_topdir, "jeos")
|
jeos_path = '%s/heat/%s/' % (possible_topdir, "jeos")
|
||||||
cfntools_path = '%s/heat/%s/' % (possible_topdir, "cfntools")
|
cfntools_path = '%s/heat/%s/' % (possible_topdir, "cfntools")
|
||||||
|
jeos_path = os.path.join(possible_topdir, 'jeos')
|
||||||
|
cfntools_path = os.path.join(possible_topdir, 'cfntools')
|
||||||
else:
|
else:
|
||||||
for p in sys.path:
|
for p in sys.path:
|
||||||
if 'heat' in p:
|
jeos_path = os.path.join(p, 'heat', 'jeos')
|
||||||
jeos_path = '%s/heat/%s/' % (p, "jeos")
|
cfntools_path = os.path.join(p, 'heat', 'cfntools')
|
||||||
cfntools_path = '%s/heat/%s/' % (p, "cfntools")
|
if os.access(jeos_path, os.R_OK):
|
||||||
break
|
break
|
||||||
|
|
||||||
gettext.install('heat', unicode=1)
|
gettext.install('heat', unicode=1)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
import functools
|
import functools
|
||||||
import os
|
import os
|
||||||
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
import base64
|
import base64
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
@ -132,7 +133,8 @@ def jeos_create(options, arguments, jeos_path, cfntools_path):
|
||||||
logging.error('*** %s does not exist.' % (iso))
|
logging.error('*** %s does not exist.' % (iso))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
tdl_path = '%s%s-%s-%s-jeos.tdl' % (jeos_path, distro, arch, instance_type)
|
tdl_file = '%s-%s-%s-jeos.tdl' % (distro, arch, instance_type)
|
||||||
|
tdl_path = os.path.join(jeos_path, tdl_file)
|
||||||
if options.debug:
|
if options.debug:
|
||||||
print "Using tdl: %s" % tdl_path
|
print "Using tdl: %s" % tdl_path
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue