update fabric file
This commit is contained in:
parent
3a39aacd85
commit
a2ed9b2839
2 changed files with 13 additions and 28 deletions
|
@ -51,7 +51,7 @@ def download_if_needed(vdi_dir, xml_dir, vm_name, vm_vdi_file, vm_xml_file):
|
|||
local("wget %s/%s/%s -O %s"%(env.vm_download_url, vm_name, vm_xml_file, os.path.join(xml_dir, vm_xml_file)))
|
||||
|
||||
|
||||
def create_fresh_os(vm_name, update_virtualenv=False, debian=False):
|
||||
def create_fresh_os(vm_name, lucid=False, debian=False):
|
||||
|
||||
"""
|
||||
remove known_hosts because if two virtual machines get the same ip address,
|
||||
|
@ -66,27 +66,7 @@ def create_fresh_os(vm_name, update_virtualenv=False, debian=False):
|
|||
vdi_snapshot_dir = os.path.expanduser('~/tmp/vms/%s/Snapshots'%vm_name)
|
||||
xml_dir = os.path.expanduser('~/.VirtualBox')
|
||||
vm_xml_path = os.path.join(xml_dir, vm_xml_file)
|
||||
|
||||
"""
|
||||
if not os.path.exists("%s/vm_registered"%vdi_dir) and os.path.exists(vm_xml_path):
|
||||
#vm_xml file exists, but it wasn't registered. Did something go wrong on a previous attempt?
|
||||
#Let's attempt to correct this by completely removing the virtual machine.
|
||||
|
||||
dom = parse(vm_xml_path)
|
||||
root = dom.childNodes[0]
|
||||
rootChildren = root.childNodes
|
||||
|
||||
#manually remove all snapshots before removing virtual machine
|
||||
for rc in rootChildren:
|
||||
if rc.nodeType == Node.ELEMENT_NODE and rc.localName == "Machine":
|
||||
snapshotNodes = rc.getElementsByTagName("Snapshot")
|
||||
for sn in snapshotNodes:
|
||||
local("VBoxManage snapshot %s delete %s"% (vm_name, sn.getAttribute("uuid")[1:-1]))
|
||||
|
||||
os.remove(vm_xml_path)
|
||||
local("VBoxManage unregistervm %s --delete"% vm_name)
|
||||
"""
|
||||
|
||||
|
||||
download_if_needed(vdi_dir, xml_dir, vm_name, vm_vdi_file, vm_xml_file)
|
||||
|
||||
if not os.path.exists("%s/vm_registered"%vdi_dir):
|
||||
|
@ -122,7 +102,7 @@ def create_fresh_os(vm_name, update_virtualenv=False, debian=False):
|
|||
env.hosts.append(ip_addr)
|
||||
env.host_string = ip_addr
|
||||
|
||||
if update_virtualenv:
|
||||
if lucid:
|
||||
print "Lucid detected - updating python virtualenv"
|
||||
sudo('apt-get update')
|
||||
sudo('apt-get install -y python-setuptools')
|
||||
|
@ -130,16 +110,20 @@ def create_fresh_os(vm_name, update_virtualenv=False, debian=False):
|
|||
|
||||
sudo('dpkg -i python-virtualenv_1.4.9-3_all.deb')
|
||||
|
||||
#supress rabbitmq bug that makes an upgrade warning pop-up even though it hasn't been
|
||||
#installed before.
|
||||
sudo('echo "rabbitmq-server rabbitmq-server/upgrade_previous note" | debconf-set-selections')
|
||||
|
||||
if debian:
|
||||
append('/etc/apt/sources.list', "deb http://www.debian-multimedia.org squeeze main non-free", use_sudo=True)
|
||||
|
||||
def ubuntu_lucid_32(fresh_os=True):
|
||||
if (fresh_os):
|
||||
create_fresh_os('Ubuntu_10.04_32', update_virtualenv=True)
|
||||
create_fresh_os('Ubuntu_10.04_32', lucid=True)
|
||||
|
||||
def ubuntu_lucid_64(fresh_os=True):
|
||||
if (fresh_os):
|
||||
create_fresh_os('Ubuntu_10.04_64', update_virtualenv=True)
|
||||
create_fresh_os('Ubuntu_10.04_64', lucid=True)
|
||||
|
||||
def ubuntu_maverick_32(fresh_os=True):
|
||||
if (fresh_os):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue