From f6626c713437255d6dbf160ffcca845f8982df3c Mon Sep 17 00:00:00 2001 From: Stephen Benjamin Date: Tue, 17 Sep 2024 08:49:43 -0400 Subject: [PATCH] Make registry available from squid proxy as well --- 02_configure_host.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/02_configure_host.sh b/02_configure_host.sh index 593c1a68e..b85e0dfdb 100755 --- a/02_configure_host.sh +++ b/02_configure_host.sh @@ -365,6 +365,13 @@ fi sudo sed -i "/${LOCAL_REGISTRY_DNS_NAME}/d" /etc/hosts echo "${PROVISIONING_HOST_EXTERNAL_IP} ${LOCAL_REGISTRY_DNS_NAME}" | sudo tee -a /etc/hosts +# Make sure any squid containers get the registry name, and make squid +# reload it's config. +for container in $(podman ps --format "{{.Names}}" | grep squid); do + echo "Updating /etc/hosts in container: $container" + podman exec -it "$container" sh -c "grep -v '${LOCAL_REGISTRY_DNS_NAME}' /etc/hosts > /tmp/hosts && echo '${PROVISIONING_HOST_EXTERNAL_IP} ${LOCAL_REGISTRY_DNS_NAME}' >> /tmp/hosts && cp -f /tmp/hosts /etc/hosts && kill -HUP 1" +done + if use_registry "podman"; then # Remove any previous file, or podman login panics when reading the # blank authfile with a "assignment to entry in nil map" error