From e683b78c39c682624a56339857d550f89c5ff54f Mon Sep 17 00:00:00 2001 From: Bernard Cafarelli Date: Thu, 11 Aug 2016 12:10:43 +0200 Subject: [PATCH] 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 --- devstack/plugin.sh | 5 +---- diskimage-create/diskimage-create.sh | 14 +++++++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/devstack/plugin.sh b/devstack/plugin.sh index 9776419c05..3693229087 100644 --- a/devstack/plugin.sh +++ b/devstack/plugin.sh @@ -21,13 +21,10 @@ function build_octavia_worker_image { TOKEN=$(openstack token issue | grep ' id ' | get_field 2) 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 - $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -s 2 - # $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -o $OCTAVIA_AMP_IMAGE_NAME + $OCTAVIA_DIR/diskimage-create/diskimage-create.sh -s 2 -o $OCTAVIA_AMP_IMAGE_FILE fi upload_image file://${OCTAVIA_AMP_IMAGE_FILE} $TOKEN - # upload_image file://${OCTAVIA_AMP_IMAGE_NAME}.qcow2 $TOKEN } function create_octavia_accounts { diff --git a/diskimage-create/diskimage-create.sh b/diskimage-create/diskimage-create.sh index 2ea80afd66..98d30c92c6 100755 --- a/diskimage-create/diskimage-create.sh +++ b/diskimage-create/diskimage-create.sh @@ -106,7 +106,7 @@ while getopts "a:b:c:hi:o:t:r:s:vw:" opt; do fi ;; o) - AMP_OUTPUTFILENAME=$OPTARG + AMP_OUTPUTFILENAME=$(readlink -f $OPTARG) ;; t) AMP_IMAGETYPE=$OPTARG @@ -153,7 +153,7 @@ AMP_CACHEDIR=${AMP_CACHEDIR:-"$HOME/.cache/image-create"} 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"} @@ -254,18 +254,18 @@ if [ "$platform" = 'NAME="Ubuntu"' ]; then fi elif [ "$platform" = 'NAME=Fedora' ]; then - PKG_LIST="qemu kpartx git" + PKG_LIST="qemu kpartx git python-pip" 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." exit 1 fi done else # 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 - if ! yum list $pkg &> /dev/null; then + if ! yum list installed $pkg &> /dev/null; then echo "Required package " $pkg " is not installed. Exiting." exit 1 fi @@ -273,7 +273,7 @@ else if [ ${platform:0:6} = "CentOS" ]; then # install EPEL repo, in order to install 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 "installed separately from the EPEL repo." echo "Required package " $pkg " is not installed. Exiting."