]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Use some evil to get the jeos tdl path
authorSteven Dake <sdake@redhat.com>
Wed, 4 Apr 2012 16:17:25 +0000 (09:17 -0700)
committerSteven Dake <sdake@redhat.com>
Wed, 4 Apr 2012 16:18:41 +0000 (09:18 -0700)
Resolves issue #46
heat:251 tdl_path uses get_python_lib() which doesn't work with eggs

Signed-off-by: Steven Dake <sdake@redhat.com>
bin/heat

index 4b186982772b1da465ed1d2a19ddc114cc2c7006..7bda4495685be7cabed5c997d3b6bfc92a18140f 100755 (executable)
--- a/bin/heat
+++ b/bin/heat
@@ -25,6 +25,9 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
                                    os.pardir))
 if os.path.exists(os.path.join(possible_topdir, 'heat', '__init__.py')):
     sys.path.insert(0, possible_topdir)
+    jeos_path = '%s/heat/%s/' % (possible_topdir, "jeos")
+else:
+    jeos_path = '%s/heat/%s/' % (sys.path[1], "jeos")
 
 gettext.install('heat', unicode=1)
 
@@ -212,6 +215,8 @@ def stack_list(options, arguments):
 def jeos_create(options, arguments):
     '''
     '''
+    global jeos_path
+
     # if not running as root, return EPERM to command line
     if os.geteuid() != 0:
         print "jeos_create must be run as root"
@@ -258,7 +263,7 @@ def jeos_create(options, arguments):
             print '*** %s does not exist.' % (iso)
             sys.exit(1)
 
-    tdl_path = '%s/heat/jeos/%s-%s-%s-jeos.tdl' % (get_python_lib(), distro, arch, instance_type)
+    tdl_path = '%s%s-%s-%s-jeos.tdl' % (jeos_path, distro, arch, instance_type)
     dsk_filename = '/var/lib/libvirt/images/%s-%s-%s-jeos.dsk' % (distro, arch, instance_type)
     qcow2_filename = '/var/lib/libvirt/images/%s-%s-%s-jeos.qcow2' % (distro, arch, instance_type)
     image_name = '%s-%s-%s' % (distro, arch, instance_type)