DIB output filename and requirements fixes

Change default output directory to working directory (systemwide script
    would by default try to create images in /usr/bin)
Canonicalize output filename parameter, else relative paths would
    generate images in temporary directory)
Clean devstack plugin to use the -o option again
Fix yum package detection ("yum list" reports success if the package
    exists in enabled repositories)
Add python-pip to the needed packages (for later pip calls)

Change-Id: Iff22a83f4a73e7aa36ee892773c01f13738f7a43
This commit is contained in:
Bernard Cafarelli 2016-08-11 12:10:43 +02:00
parent 598f8540ea
commit e683b78c39
2 changed files with 8 additions and 11 deletions

View File

@ -21,13 +21,10 @@ function build_octavia_worker_image {
TOKEN=$(openstack token issue | grep ' id ' | get_field 2) TOKEN=$(openstack token issue | grep ' id ' | get_field 2)
die_if_not_set $LINENO TOKEN "Keystone failed to get token." die_if_not_set $LINENO TOKEN "Keystone failed to get token."
# TODO(ptoohill): Tempfix..? -o option stopped working and it no longer saves image to working dir...
if ! [ -f $OCTAVIA_AMP_IMAGE_FILE ]; then if ! [ -f $OCTAVIA_AMP_IMAGE_FILE ]; then
$OCTAVIA_DIR/diskimage-create/diskimage-create.sh -s 2 $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -s 2 -o $OCTAVIA_AMP_IMAGE_FILE
# $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -o $OCTAVIA_AMP_IMAGE_NAME
fi fi
upload_image file://${OCTAVIA_AMP_IMAGE_FILE} $TOKEN upload_image file://${OCTAVIA_AMP_IMAGE_FILE} $TOKEN
# upload_image file://${OCTAVIA_AMP_IMAGE_NAME}.qcow2 $TOKEN
} }
function create_octavia_accounts { function create_octavia_accounts {

View File

@ -106,7 +106,7 @@ while getopts "a:b:c:hi:o:t:r:s:vw:" opt; do
fi fi
;; ;;
o) o)
AMP_OUTPUTFILENAME=$OPTARG AMP_OUTPUTFILENAME=$(readlink -f $OPTARG)
;; ;;
t) t)
AMP_IMAGETYPE=$OPTARG AMP_IMAGETYPE=$OPTARG
@ -153,7 +153,7 @@ AMP_CACHEDIR=${AMP_CACHEDIR:-"$HOME/.cache/image-create"}
AMP_BASEOS=${AMP_BASEOS:-"ubuntu"} AMP_BASEOS=${AMP_BASEOS:-"ubuntu"}
AMP_OUTPUTFILENAME=${AMP_OUTPUTFILENAME:-"$AMP_DIR/amphora-x64-haproxy"} AMP_OUTPUTFILENAME=${AMP_OUTPUTFILENAME:-"$PWD/amphora-x64-haproxy"}
AMP_IMAGETYPE=${AMP_IMAGETYPE:-"qcow2"} AMP_IMAGETYPE=${AMP_IMAGETYPE:-"qcow2"}
@ -254,18 +254,18 @@ if [ "$platform" = 'NAME="Ubuntu"' ]; then
fi fi
elif [ "$platform" = 'NAME=Fedora' ]; then elif [ "$platform" = 'NAME=Fedora' ]; then
PKG_LIST="qemu kpartx git" PKG_LIST="qemu kpartx git python-pip"
for pkg in $PKG_LIST; do for pkg in $PKG_LIST; do
if ! yum list $pkg &> /dev/null; then if ! yum list installed $pkg &> /dev/null; then
echo "Required package " $pkg " is not installed. Exiting." echo "Required package " $pkg " is not installed. Exiting."
exit 1 exit 1
fi fi
done done
else else
# centos or rhel # centos or rhel
PKG_LIST="qemu-kvm qemu-img kpartx git" PKG_LIST="qemu-kvm qemu-img kpartx git python-pip"
for pkg in $PKG_LIST; do for pkg in $PKG_LIST; do
if ! yum list $pkg &> /dev/null; then if ! yum list installed $pkg &> /dev/null; then
echo "Required package " $pkg " is not installed. Exiting." echo "Required package " $pkg " is not installed. Exiting."
exit 1 exit 1
fi fi
@ -273,7 +273,7 @@ else
if [ ${platform:0:6} = "CentOS" ]; then if [ ${platform:0:6} = "CentOS" ]; then
# install EPEL repo, in order to install argparse # install EPEL repo, in order to install argparse
PKG_LIST="python-argparse" PKG_LIST="python-argparse"
if ! yum list $pkg &> /dev/null; then if ! yum list installed $pkg &> /dev/null; then
echo "CentOS requires the python-argparse package be " echo "CentOS requires the python-argparse package be "
echo "installed separately from the EPEL repo." echo "installed separately from the EPEL repo."
echo "Required package " $pkg " is not installed. Exiting." echo "Required package " $pkg " is not installed. Exiting."