Skip to content

Commit 8b2133d

Browse files
committed
update-template-ubuntu.sh: add error message for when com.ubuntu.cloud:released:download.json does not contain a matching image
Signed-off-by: Norio Nomura <[email protected]>
1 parent becafdb commit 8b2133d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hack/update-template-ubuntu.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ function ubuntu_image_url_latest() {
176176
[\"${base_url}\"+.path, \"sha256:\"+.sha256, \$release] | @tsv
177177
] | last
178178
"
179-
location_digest_release=$(jq -e -r "${jq_filter}" "${ubuntu_downloaded_json}")
180-
179+
location_digest_release=$(jq -r "${jq_filter}" "${ubuntu_downloaded_json}")
180+
[[ ${location_digest_release} != "null" ]] ||
181+
error_exit "The URL for ubuntu-${version}-${flavor}-cloudimg-${arch}${path_suffix} is not provided at ${ubuntu_base_urls[${flavor}]}."
181182
local location digest release location_using_version
182183
read -r location digest release <<<"${location_digest_release}"
183184
location=$(validate_url "${location}")
@@ -199,7 +200,9 @@ function ubuntu_image_url_release() {
199200
.release
200201
] | first
201202
"
202-
release=$(jq -e -r "${jq_filter}" "${ubuntu_downloaded_json}")
203+
release=$(jq -r "${jq_filter}" "${ubuntu_downloaded_json}")
204+
[[ ${release} != "null" ]] ||
205+
error_exit "The URL for ubuntu-${version}-${flavor}-cloudimg-${arch}${path_suffix} is not provided at ${ubuntu_base_urls[${flavor}]}."
203206
location=$(validate_url "${base_url}${release}/release/ubuntu-${version}-${flavor}-cloudimg-${arch}${path_suffix}")
204207
location=$(ubuntu_image_url_try_replace_release_with_version "${location}" "${release}" "${version}")
205208
arch=$(limayaml_arch "${arch}")

0 commit comments

Comments
 (0)