aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKerim Gokarslan <kgokarsl@cisco.com>2017-11-28 10:24:00 -0800
committerKerim Gokarslan <kgokarsl@cisco.com>2017-11-28 17:09:40 -0800
commit1d4d036af9da5c744b0a4f711e30022fedb6e640 (patch)
tree28a5df18ea3e7e401056f35411e49a36deb25799
parent48761532adf2420d7932149cc0e16c69804e9c16 (diff)
NFVBENCH-48 Check gsutil when building the vm image
Change-Id: I2c049679be27c4404ba859d30c8b37f17b60496f Signed-off-by: Kerim Gokarslan <kgokarsl@cisco.com>
-rwxr-xr-xnfvbenchvm/dib/build-image.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/nfvbenchvm/dib/build-image.sh b/nfvbenchvm/dib/build-image.sh
index 605db54..43795e4 100755
--- a/nfvbenchvm/dib/build-image.sh
+++ b/nfvbenchvm/dib/build-image.sh
@@ -15,9 +15,13 @@ __version__=0.5
image_name=nfvbenchvm_centos-$__version__
# if image exists skip building
-if gsutil -q stat gs://$gs_url/$image_name.qcow2; then
- echo "Image already exists at http://$gs_url/$image_name.qcow2"
- exit 0
+if command -v gsutil >/dev/null; then
+ if gsutil -q stat gs://$gs_url/$image_name.qcow2; then
+ echo "Image already exists at http://$gs_url/$image_name.qcow2"
+ exit 0
+ fi
+else
+ echo "Cannot check image availability in OPNFV artifact repository (gsutil not available)"
fi
# install diskimage-builder
@@ -50,6 +54,10 @@ echo "Building $image_name.qcow2..."
time disk-image-create -o $image_name centos7 nfvbenchvm
ls -l $image_name.qcow2
-echo "Uploading $image_name.qcow2..."
-gsutil cp $image_name.qcow2 gs://$gs_url/$image_name.qcow2
-echo "You can access to image at http://$gs_url/$image_name.qcow2"
+if command -v gsutil >/dev/null; then
+ echo "Uploading $image_name.qcow2..."
+ gsutil cp $image_name.qcow2 gs://$gs_url/$image_name.qcow2
+ echo "You can access to image at http://$gs_url/$image_name.qcow2"
+else
+ echo "Cannot upload new image to the OPNFV artifact repository (gsutil not available)"
+fi