From f78382fee2ffc2f809450b909236c9439376b345 Mon Sep 17 00:00:00 2001 From: reyesj2 <94730068+reyesj2@users.noreply.github.com> Date: Sun, 29 Nov 2026 17:51:03 -0600 Subject: [PATCH] revert so-image-pull and so-tcpreplay to 3/dev Drop the embedded-registry shortcut from both scripts so they match 3/dev byte for byte, and delete the three so-image-common helpers that only those shortcuts used. --- salt/common/tools/sbin/so-image-common | 28 ----------------------- salt/common/tools/sbin/so-image-pull | 15 ++++-------- salt/common/tools/sbin_jinja/so-tcpreplay | 8 +++---- 3 files changed, 7 insertions(+), 44 deletions(-) diff --git a/salt/common/tools/sbin/so-image-common b/salt/common/tools/sbin/so-image-common index 7f45c5e3c..4717e8b09 100755 --- a/salt/common/tools/sbin/so-image-common +++ b/salt/common/tools/sbin/so-image-common @@ -86,34 +86,6 @@ registry_host() { printf '%s' "$HOSTNAME" } -local_registry_image_present() { - local image_name=$1 - local image_tag=$2 - local host - host=$(registry_host) - docker images --format '{{.Repository}}:{{.Tag}}' | grep -qx "${host}:5000/${IMAGEREPO}/${image_name}:${image_tag}" -} - -registry_has_image() { - local image_name=$1 - local image_tag=$2 - local host - host=$(registry_host) - - curl -sk --fail --max-time 10 \ - -H "Accept: application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.manifest.v1+json, application/vnd.docker.distribution.manifest.list.v2+json, application/vnd.oci.image.index.v1+json" \ - -o /dev/null \ - "https://${host}:5000/v2/${IMAGEREPO}/${image_name}/manifests/${image_tag}" -} - -pull_from_embedded_registry() { - local image_name=$1 - local image_tag=$2 - local host - host=$(registry_host) - docker pull "${host}:5000/${IMAGEREPO}/${image_name}:${image_tag}" -} - manifest_blob_digests() { jq -r '(.config.digest // empty), (.layers[]? | .digest)' "$1" } diff --git a/salt/common/tools/sbin/so-image-pull b/salt/common/tools/sbin/so-image-pull index 918146c72..915547c8e 100755 --- a/salt/common/tools/sbin/so-image-pull +++ b/salt/common/tools/sbin/so-image-pull @@ -38,20 +38,13 @@ TRUSTED_CONTAINERS=("$@") set_version for image in "${TRUSTED_CONTAINERS[@]}"; do - if local_registry_image_present "$image" "$VERSION"; then - echo "$image:$VERSION image exists." - continue - fi - if registry_has_image "$image" "$VERSION"; then + if ! docker images | grep "$image" | grep ":5000" | grep -q "$VERSION"; then if [[ $quiet == true ]]; then - pull_from_embedded_registry "$image" "$VERSION" >/dev/null && continue + update_docker_containers "$image" "" "" "/dev/null" else - pull_from_embedded_registry "$image" "$VERSION" && continue + update_docker_containers "$image" "" "" "" fi - fi - if [[ $quiet == true ]]; then - update_docker_containers "$image" "" "" "/dev/null" else - update_docker_containers "$image" "" "" "" + echo "$image:$VERSION image exists." fi done diff --git a/salt/common/tools/sbin_jinja/so-tcpreplay b/salt/common/tools/sbin_jinja/so-tcpreplay index ca2fca829..969ca699f 100755 --- a/salt/common/tools/sbin_jinja/so-tcpreplay +++ b/salt/common/tools/sbin_jinja/so-tcpreplay @@ -39,15 +39,13 @@ if ! docker ps | grep -q so-tcpreplay; then if is_manager_node; then set_version - if local_registry_image_present so-tcpreplay "$VERSION" ; then - echo "so-tcpreplay image exists." - elif registry_has_image so-tcpreplay "$VERSION" && pull_from_embedded_registry so-tcpreplay "$VERSION" ; then - echo "Loaded so-tcpreplay image from embedded registry" - else + if ! docker images | grep so-tcpreplay | grep ":5000" | grep -q $VERSION ; then echo "Pulling so-tcpreplay image" TRUSTED_CONTAINERS=("so-tcpreplay") mkdir -p /opt/so/log/tcpreplay update_docker_containers "tcpreplay" "" "" "/opt/so/log/tcpreplay/init.log" + else + echo "so-tcpreplay image exists." fi fi if is_sensor_node; then