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):
import os
import sys
import base64
-import libxml2
+from lxml import etree
import re
import logging
@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.
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:
# 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:
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,
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