summaryrefslogtreecommitdiff
path: root/files/image.sh
diff options
context:
space:
mode:
authorCarlos Konstanski <ckonstanski@pippiandcarlos.com>2017-12-13 18:54:21 -0700
committerCarlos Konstanski <ckonstanski@pippiandcarlos.com>2017-12-13 18:54:21 -0700
commit32086f62131e1b813e2f3d97bc2c78f66c6a3154 (patch)
tree2005059011aea64121af64de5b3567fd0dcbca3b /files/image.sh
parent21fa10807bb475bff42a997ac4add3cc7e6346f9 (diff)
adding files
Diffstat (limited to 'files/image.sh')
-rwxr-xr-xfiles/image.sh17
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