diff --git a/ci/common.yml b/ci/common.yml
index 9f3f251c347ca1df93b82f39f8ff96e9b075858b..d662d34023a90c5b006e916c4a7ba5e96f473dc1 100644
--- a/ci/common.yml
+++ b/ci/common.yml
@@ -18,12 +18,23 @@
 .get_latest_image: &get_latest_image
   - |
     if [[ -z "${IMAGE}" ]]; then
-      if [[ "${OS: -1}" -eq "s" ]]; then
-        SEARCH="--property os_distro="CS" --property os_distro_major=\"${OS:0:-1}\""
+      if [[ "${OS: -1}" == "s" ]]; then
+        OS_DISTRO="CS"
+        OS_MAJOR="${OS:0:-1}"
       else
-        SEARCH="--property os_distro_major=\"${OS}\""
+        OS_MAJOR="${OS}"
+        if [[ "${OS}" -eq 7 ]]; then
+          OS_DISTRO="CC"
+        else
+          OS_DISTRO="C"
+        fi
+      fi
+      IMAGE=$(openstack image list --property os_distro="${OS_DISTRO}" --property os_distro_major="${OS_MAJOR}" --property os_edition="Base" --public --sort created_at -c ID -f value | tail -n1)
+      if [[ -z "${IMAGE}" ]]; then
+        echo "No image found matching:"
+        echo openstack image list --property os_distro="${OS_DISTRO}" --property os_distro_major="${OS_MAJOR}" --property os_edition="Base" --public --sort created_at
+        exit 1
       fi
-      IMAGE=$(openstack image list $SEARCH --property os_edition="Base" --public --sort created_at -c ID -f value | tail -n1)
     fi
 
 .test_unmanaged_physical: