update fabric file
This commit is contained in:
parent
3a39aacd85
commit
a2ed9b2839
|
@ -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):
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
exec 2>&1
|
||||
|
||||
target="airtime_git_branch"
|
||||
#airtime_versions=("" "airtime_182_tar" "airtime_194_tar")
|
||||
airtime_versions=("" "airtime_182_tar" "airtime_195_tar")
|
||||
airtime_versions=("" "airtime_182_tar" "airtime_195_tar")
|
||||
#airtime_versions=("")
|
||||
ubuntu_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_maverick_32" "ubuntu_maverick_64" "ubuntu_natty_32" "ubuntu_natty_64" "debian_squeeze_32" "debian_squeeze_64")
|
||||
#ubuntu_versions=("ubuntu_lucid_32" "ubuntu_lucid_64" "ubuntu_maverick_32" "ubuntu_maverick_64" "ubuntu_natty_32" "ubuntu_natty_64" "ubuntu_oneiric_32" "ubuntu_oneiric_64" "debian_squeeze_32" "debian_squeeze_64")
|
||||
ubuntu_versions=("ubuntu_natty_32" "ubuntu_natty_64")
|
||||
|
||||
num1=${#ubuntu_versions[@]}
|
||||
num2=${#airtime_versions[@]}
|
||||
|
@ -15,6 +15,7 @@ mkdir -p ./upgrade_logs
|
|||
|
||||
for i in $(seq 0 $(($num1 -1)));
|
||||
do
|
||||
#echo fab -f fab_setup.py os_update shutdown
|
||||
for j in $(seq 0 $(($num2 -1)));
|
||||
do
|
||||
echo fab -f fab_setup.py ${ubuntu_versions[$i]} ${airtime_versions[$j]} $target shutdown
|
||||
|
|
Loading…
Reference in New Issue