]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Finish necessary changes related to jeos_create move
authorJeff Peeler <jpeeler@redhat.com>
Fri, 27 Apr 2012 20:44:11 +0000 (16:44 -0400)
committerJeff Peeler <jpeeler@redhat.com>
Fri, 27 Apr 2012 20:53:28 +0000 (16:53 -0400)
As a result of moving jeos_create, the code is now used during test
execution. The library libxml2 which was previously being used is not
available in pip, so lxml has been swapped instead.

Signed-off-by: Jeff Peeler <jpeeler@redhat.com>
bin/heat
heat/utils.py
tools/pip-requires

index 51f112d2e19c186c1177b53670d3ec0f35d3bace..6c8122956315bfed1006721a9e840044e7322c8e 100755 (executable)
--- a/bin/heat
+++ b/bin/heat
@@ -270,7 +270,7 @@ def jeos_create(options, arguments):
     The command must be run as root in order for libvirt to have permissions
     to create virtual machines and read the raw DVDs.
     '''
-    utils.jeos_create(options, arguments)
+    utils.jeos_create(options, arguments, jeos_path, cfntools_path)
 
 
 def get_client(options):
index 5d7e1532dbec2abc7bf2f8510858e18135493d59..0691d241281001c815bbd9a1aff7bb338e09e830 100644 (file)
@@ -17,7 +17,7 @@ import functools
 import os
 import sys
 import base64
-import libxml2
+from lxml import etree
 import re
 import logging
 
@@ -59,7 +59,7 @@ def catch_error(action):
 
 
 @catch_error('jeos_create')
-def jeos_create(options, arguments):
+def jeos_create(options, arguments, jeos_path, cfntools_path):
     '''
     Create a new JEOS (Just Enough Operating System) image.
 
@@ -74,8 +74,6 @@ def jeos_create(options, arguments):
     The command must be run as root in order for libvirt to have permissions
     to create virtual machines and read the raw DVDs.
     '''
-    global jeos_path
-    global cfntools_path
 
     # if not running as root, return EPERM to command line
     if os.geteuid() != 0:
@@ -136,7 +134,7 @@ def jeos_create(options, arguments):
     # Load the cfntools into the cfntool image by encoding them in base64
     # and injecting them into the TDL at the appropriate place
     if instance_type == 'cfntools':
-        tdl_xml = libxml2.parseFile(tdl_path)
+        tdl_xml = etree.parse(tdl_path)
         cfn_tools = ['cfn-init', 'cfn-hup', 'cfn-signal', \
                     'cfn-get-metadata', 'cfn_helper.py']
         for cfnname in cfn_tools:
@@ -144,10 +142,10 @@ def jeos_create(options, arguments):
             cfscript_e64 = base64.b64encode(f.read())
             f.close()
             cfnpath = "/template/files/file[@name='/opt/aws/bin/%s']" % cfnname
-            tdl_xml.xpathEval(cfnpath)[0].setContent(cfscript_e64)
+            tdl_xml.xpath(cfnpath)[0].text = cfscript_e64
 
         # TODO(sdake) INSECURE
-        tdl_xml.saveFormatFile('/tmp/tdl', format=1)
+        tdl_xml.write('/tmp/tdl', xml_declaration=True)
         tdl_path = '/tmp/tdl'
 
     dsk_filename = '%s/%s-%s-%s-jeos.dsk' % (images_dir, distro,
index 4e4802ec1d056a76de392a037d5ac22552e6d0b7..a364bcf0b95b0cbf3965cb6fba64fb258d849f21 100644 (file)
@@ -16,3 +16,10 @@ httplib2
 kombu
 iso8601>=0.1.4
 python-novaclient
+glance
+
+# Note you will need gcc buildtools installed and must
+# have installed libxml headers for lxml to be successfully
+# installed using pip, therefore you will need to install the
+# libxml2-dev(el) and libxslt-dev(el) packages.
+lxml