Markus Zoeller d126b3f92e fix "add-apt-repository: command not found" error
For the "happy path" to makes things work, we use the Ubuntu Cloud
Archives. This repository has to be added. The command to do that
is not available on the gate test nodes [1].

This change installs a package which brings the command
"add-apt-repository" with it.

References:
[1] https://github.com/openstack-infra/project-config/commit/
f90d35885e1143e5a1b67804735fd0c2f294457c

Change-Id: I608c8a35297765283a61ddfadf32d8191186d6c3
2016-03-31 11:49:21 +02:00

98 lines
2.7 KiB
Bash
Executable File

#!/bin/bash
#
# lib/libvirt
#
# Dependencies:
# TODO: Fill this out
# Save trace setting
XTRACE=$(set +o | grep xtrace)
set +o xtrace
# Uses globals ``REQUIREMENTS_DIR``
# Uses functions ``get_from_global_requirements``
function pre_install_libvirt_ubuntu {
# NOTE(markus_z): The command "add-apt-repository" is not available
# in the test nodes. We add it here:
sudo apt-get install -y software-properties-common
# We don't use install_package as we know we're on ubuntu and we do a few
# "special" things to make the plugin "just work"
sudo add-apt-repository -y cloud-archive:liberty
sudo apt-get update
# NOTE(tonyb): This will nuke any/all libvirt config changes
sudo apt-get -o Dpkg::Options::="--force-confnew,confmiss" \
install -y \
libvirt-{bin,dev}=1.2.16-2ubuntu11.15.10.3~cloud0 \
qemu-{kvm,utils}=1:2.3+dfsg-5ubuntu9.1~cloud0
# We *need* to ensure that libvirt-python is built against the new version
# of libvirt.so.0 Bypass the cache. This is little sub-optimal becuase we
# bypass both the http and wheel caches when we really only want to bypass
# the wheel cache. Ho Hum
sudo pip install --no-cache-dir --upgrade --no-deps --force-reinstall \
-c $REQUIREMENTS_DIR/upper-constraints.txt \
$(get_from_global_requirements libvirt-python)
}
function shutdown_libvirt_ubuntu {
# NOTE(tonyb): This will nuke any/all libvirt config changes
sudo apt-get purge -y libvirt-bin libvirt-dev libvirt0 \
qemu-kvm qemu-utils qemu-system-x86 \
qemu-system-common qemu-block-extra:amd64 seabios
# This is overkill
# sudo apt-get autoremove -y
sudo add-apt-repository -y -r cloud-archive:liberty
sudo rm /etc/apt/sources.list.d/cloudarchive-liberty.list*
# Be nice to whomever folows and make sure apt-get install libvirt-bin
# will work *and* not be from UCA
sudo apt-get update
# Make sure we don't leave an almost certainly broken libvirt-python
# installed
sudo pip uninstall -y libvirt-python
}
function pre_install_libvirt {
if is_ubuntu; then
pre_install_libvirt_ubuntu
else
echo "libvirt isn't available for $DISTRO"
fi
}
function install_libvirt {
# Install the service.
:
}
function configure_libvirt {
# Configure the service.
:
}
function init_add_libvirt {
# Initialize and start the service.
:
}
function shutdown_libvirt {
if is_ubuntu; then
shutdown_libvirt_ubuntu
fi
}
# FIXME: Need to work on the cleanup side
function cleanup_libvirt {
# Cleanup the service.
:
}
# Restore xtrace
$XTRACE
## Local variables:
## mode: shell-script
## End: