summaryrefslogtreecommitdiff
path: root/files/image.sh
blob: fd694cdc7f68f191d2a1abd2e3ffa034aaefecd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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