From 32086f62131e1b813e2f3d97bc2c78f66c6a3154 Mon Sep 17 00:00:00 2001 From: Carlos Konstanski Date: Wed, 13 Dec 2017 18:54:21 -0700 Subject: adding files --- files/image.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100755 files/image.sh (limited to 'files/image.sh') diff --git a/files/image.sh b/files/image.sh new file mode 100755 index 0000000..fd694cd --- /dev/null +++ b/files/image.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +image_name="${1}" + +if [ "${image_name}" == "" ]; then + echo "No image name supplied." >&2 + exit 1 +fi + +image_id=$(openstack image list --limit 1000 --public 2>/dev/null | grep -F " ${image_name} " | awk '{print $2;}') +if [ "${image_id}" == "" ]; then + echo -n "Cannot retrieve an image ID corresponding to the name: " >&2 + echo "${image_name}" >&2 + exit 1 +fi + +exit 0 -- cgit v1.3