diff options
Diffstat (limited to 'files/image.sh')
| -rwxr-xr-x | files/image.sh | 17 |
1 files changed, 17 insertions, 0 deletions
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 |
