Browse Source

fix: [compose-core] apply a few cleaning and improvements to ``service_ensure_image_ready``

master
Valentin Lab 3 weeks ago
parent
commit
764cd23a3c
  1. 9
      bin/compose-core

9
bin/compose-core

@ -1642,7 +1642,7 @@ cache:image:registry:get() {
if [[ "$out" != *"manifest unknown"* ]] && [[ "$out" != *"not found"* ]]; then if [[ "$out" != *"manifest unknown"* ]] && [[ "$out" != *"not found"* ]]; then
print_status failure >&2 print_status failure >&2
Feed >&2 Feed >&2
err "Failed to pull image '$COMPOSE_DOCKER_REGISTRY/$charm_image'" \
err-d "Failed to pull image '$COMPOSE_DOCKER_REGISTRY/$charm_image'" \
"for ${DARKYELLOW}$service${NORMAL}:" "for ${DARKYELLOW}$service${NORMAL}:"
e "$out"$'\n' | prefix " ${GRAY}|${NORMAL} " >&2 e "$out"$'\n' | prefix " ${GRAY}|${NORMAL} " >&2
return 1 return 1
@ -1810,9 +1810,8 @@ service_ensure_image_ready() {
return 1 return 1
} }
local service_quoted=${service//./\\.} local service_quoted=${service//./\\.}
if specified_image=$(echo "$service_def" | shyaml get-value image 2>/dev/null); then
if [[ "$specified_image" == "$charm_image_name"* ]]; then
if specified_image=$(e "$service_def" | shyaml get-value image 2>/dev/null); then
if [[ "$specified_image" == "$charm_image_name:"* ]]; then
## Assume we already did the change ## Assume we already did the change
printf "%s" "$specified_image" | tee "$cache_file" printf "%s" "$specified_image" | tee "$cache_file"
return 0 return 0
@ -1834,7 +1833,7 @@ service_ensure_image_ready() {
return 0 return 0
fi fi
src="$specified_image" src="$specified_image"
hash=$(echo "$specified_image" | md5sum | cut -f 1 -d " ") || return 1
hash=$(e "$specified_image"$'\n' | md5sum | cut -f 1 -d " ") || return 1
type=fetch type=fetch
## replace image by charm image ## replace image by charm image

Loading…
Cancel
Save