From af87832f5786b43705b80e7cd3a29e23c77ef2cb Mon Sep 17 00:00:00 2001 From: Saurabh Pandit Date: Thu, 21 May 2026 19:43:38 +0530 Subject: [PATCH 1/2] (PE-43842) Regenerate install.sh from updated puppet_agent module Pulls modules/puppet_agent from 9f8469c to 16d966b (40+ upstream PRs). Key changes picked up: - macOS 26 added to platform version branch (PE-43842 goal) - puppet9 collection support in apt sources detection - puppetcore and puppetcore-nightly collection sources (yum/apt/mac) - HTTP basic auth + 401 handling in do_wget/do_curl - More robust 404 regex (HTTP/.* 404) modules/facts unchanged (already at upstream tip). Co-Authored-By: Claude Opus 4.7 --- install.sh | 132 ++++++++++++++++++++++++++++--------------- modules/puppet_agent | 2 +- 2 files changed, 86 insertions(+), 48 deletions(-) diff --git a/install.sh b/install.sh index 71fcfb9..0007d3f 100755 --- a/install.sh +++ b/install.sh @@ -282,6 +282,7 @@ assert_unmodified_apt_config() { puppet_list=/etc/apt/sources.list.d/puppet.list puppet7_list=/etc/apt/sources.list.d/puppet7.list puppet8_list=/etc/apt/sources.list.d/puppet8.list + puppet9_list=/etc/apt/sources.list.d/puppet9.list if [[ -f $puppet_list ]]; then list_file=puppet_list @@ -289,6 +290,8 @@ assert_unmodified_apt_config() { list_file=puppet7_list elif [[ -f $puppet8_list ]]; then list_file=puppet8_list + elif [[ -f $puppet9_list ]]; then + list_file=puppet9_list fi # If puppet.list exists, get its md5sum on disk and its md5sum from the puppet-release package @@ -360,50 +363,46 @@ else collection='puppet' fi +if [[ "$collection" != puppetcore*-nightly && "$collection" == "puppetcore"* && -z "$password" ]]; then + echo "A password parameter is required to install from puppetcore" + exit 1 +fi + if [ -n "$PT_yum_source" ]; then yum_source=$PT_yum_source +elif [[ "$collection" == puppetcore*-nightly ]]; then + yum_source='https://artifactory.delivery.puppetlabs.net:443/artifactory/internal_nightly__local/yum' +elif [[ "$collection" == "puppetcore"* ]]; then + yum_source='https://yum-puppetcore.puppet.com/public' +elif [ "$nightly" = true ]; then + yum_source='http://nightlies.puppet.com/yum' else - if [[ "$collection" == "puppetcore"* ]]; then - yum_source='https://yum-puppetcore.puppet.com/public' - if [ -z "$password" ]; then - echo "A password parameter is required to install from ${yum_source}" - exit 1 - fi - else - if [ "$nightly" = true ]; then - yum_source='http://nightlies.puppet.com/yum' - else - yum_source='http://yum.puppet.com' - fi - fi + yum_source='http://yum.puppet.com' fi if [ -n "$PT_apt_source" ]; then apt_source=$PT_apt_source +elif [[ "$collection" == puppetcore*-nightly ]]; then + apt_source='https://artifactory.delivery.puppetlabs.net:443/artifactory/internal_nightly__local/apt' +elif [[ "$collection" == "puppetcore"* ]]; then + apt_source='https://apt-puppetcore.puppet.com/public' +elif [ "$nightly" = true ]; then + apt_source='http://nightlies.puppet.com/apt' else - if [[ "$collection" == "puppetcore"* ]]; then - apt_source='https://apt-puppetcore.puppet.com/public' - if [ -z "$password" ]; then - echo "A password parameter is required to install from ${apt_source}" - exit 1 - fi - else - if [ "$nightly" = true ]; then - apt_source='http://nightlies.puppet.com/apt' - else - apt_source='http://apt.puppet.com' - fi - fi + apt_source='http://apt.puppet.com' fi if [ -n "$PT_mac_source" ]; then mac_source=$PT_mac_source + +elif [[ "$collection" == puppetcore*-nightly ]]; then + mac_source='https://artifactory.delivery.puppetlabs.net:443/artifactory/internal_nightly__local/downloads' +elif [[ "$collection" == "puppetcore"* ]]; then + mac_source='https://artifacts-puppetcore.puppet.com/v1/download' +elif [ "$nightly" = true ]; then + mac_source='http://nightlies.puppet.com/downloads' else - if [ "$nightly" = true ]; then - mac_source='http://nightlies.puppet.com/downloads' - else - mac_source='http://downloads.puppet.com' - fi + mac_source='http://downloads.puppet.com' fi if [ -n "$PT_retry" ]; then @@ -518,6 +517,7 @@ if true; then "13") platform_version="13";; "14") platform_version="14";; "15") platform_version="15";; + "26") platform_version="26";; *) echo "No builds for platform: $major_version" exit 1 ;; @@ -633,10 +633,14 @@ run_cmd() { return $rc } -# do_wget URL FILENAME +# do_wget URL FILENAME [USERNAME] [PASSWORD] do_wget() { info "Trying wget..." - run_cmd "wget -O '$2' '$1' 2>$tmp_stderr" + if [[ -n "$3" && -n "$4" ]]; then + run_cmd "wget -O '$2' --user '$3' --password '$4' '$1' 2>$tmp_stderr" + else + run_cmd "wget -O '$2' '$1' 2>$tmp_stderr" + fi rc=$? # check for 404 @@ -646,6 +650,13 @@ do_wget() { unable_to_retrieve_package fi + # check for 401 + grep "ERROR 401" $tmp_stderr 2>&1 >/dev/null + if test $? -eq 0; then + critical "ERROR 401" + unable_to_retrieve_package + fi + # check for bad return status or empty output if test $rc -ne 0 || test ! -s "$2"; then capture_tmp_stderr "wget" @@ -655,19 +666,30 @@ do_wget() { return 0 } -# do_curl URL FILENAME +# do_curl URL FILENAME [USERNAME] [PASSWORD] do_curl() { info "Trying curl..." - run_cmd "curl -1 -sL -D $tmp_stderr '$1' > '$2'" + if [[ -n "$3" && -n "$4" ]]; then + run_cmd "curl -1 -sL -u'$3:$4' -D $tmp_stderr '$1' > '$2'" + else + run_cmd "curl -1 -sL -D $tmp_stderr '$1' > '$2'" + fi rc=$? # check for 404 - grep "404 Not Found" $tmp_stderr 2>&1 >/dev/null + grep "HTTP/.* 404" $tmp_stderr 2>&1 >/dev/null if test $? -eq 0; then critical "ERROR 404" unable_to_retrieve_package fi + # check for 401 + grep "HTTP/.* 401" $tmp_stderr 2>&1 >/dev/null + if test $? -eq 0; then + critical "ERROR 401" + unable_to_retrieve_package + fi + # check for bad return status or empty output if test $rc -ne 0 || test ! -s "$2"; then capture_tmp_stderr "curl" @@ -781,7 +803,7 @@ do_perl_ff() { return 1 } -# do_download URL FILENAME +# do_download URL FILENAME [USERNAME] [PASSWORD] do_download() { info "Downloading $1" info " to file $2" @@ -790,11 +812,11 @@ do_download() { # perl, in particular may be present but LWP::Simple may not be installed if exists wget; then - do_wget $1 $2 && return 0 + do_wget $1 $2 $3 $4 && return 0 fi if exists curl; then - do_curl $1 $2 && return 0 + do_curl $1 $2 $3 $4 && return 0 fi if exists fetch; then @@ -835,7 +857,8 @@ install_file() { if test "x$installed_version" != "xuninstalled"; then info "Version ${installed_version} detected..." major=$(echo $installed_version | cut -d. -f1) - pkg="puppet${major}-release" + pkg=$(rpm -qa --qf '%{NAME}\n' | grep "^puppet${major}.*-release$" | head -1) + [ -z "$pkg" ] && pkg="puppet${major}-release" if echo $2 | grep $pkg; then info "No collection upgrade detected" @@ -847,7 +870,7 @@ install_file() { repo="/etc/yum.repos.d/${collection/core/}-release.repo" rpm -Uvh --oldpackage --replacepkgs "$2" - if [[ "$collection" =~ core ]]; then + if [[ "$collection" != puppetcore*-nightly && "$collection" =~ core ]]; then if [[ -n $username ]]; then sed -i "s/^#\?username=.*/username=${username}/" "${repo}" fi @@ -868,7 +891,8 @@ install_file() { if test "x$installed_version" != "xuninstalled"; then info "Version ${installed_version} detected..." major=$(echo $installed_version | cut -d. -f1) - pkg="puppet${major}-release" + pkg=$(rpm -qa --qf '%{NAME}\n' | grep "^puppet${major}.*-release$" | head -1) + [ -z "$pkg" ] && pkg="puppet${major}-release" if echo $2 | grep $pkg; then info "No collection upgrade detected" @@ -879,7 +903,7 @@ install_file() { fi run_cmd "zypper install --no-confirm '$2'" - if [[ "$collection" =~ core ]]; then + if [[ "$collection" != puppetcore*-nightly && "$collection" =~ core ]]; then if [[ -n $username ]]; then sed -i "s/^username=.*/username=${username}/" "/etc/zypp/credentials.d/PuppetcoreCreds" fi @@ -899,7 +923,8 @@ install_file() { if test "x$installed_version" != "xuninstalled"; then info "Version ${installed_version} detected..." major=$(echo $installed_version | cut -d. -f1) - pkg="puppet${major}-release" + pkg=$(dpkg-query -W -f='${Package}\n' 2>/dev/null | grep "^puppet${major}.*-release$" | head -1) + [ -z "$pkg" ] && pkg="puppet${major}-release" if echo $2 | grep $pkg; then info "No collection upgrade detected" @@ -912,7 +937,7 @@ install_file() { assert_unmodified_apt_config dpkg -i --force-confmiss "$2" - if [[ "$collection" =~ core ]]; then + if [[ "$collection" != puppetcore*-nightly && "$collection" =~ core ]]; then auth_conf="/etc/apt/auth.conf.d/apt-puppetcore-puppet.conf" sed -i "/^#?login/d" "${auth_conf}" echo "login ${username}" >> "${auth_conf}" @@ -1060,7 +1085,20 @@ case $platform in if [[ $(uname -p) == "arm" ]]; then arch="arm64" fi - download_url="${mac_source}/mac/${collection}/${platform_version}/${arch}/${filename}" + if [[ "$collection" != puppetcore*-nightly && "$collection" =~ core ]]; then + if [[ -z "$version" ]]; then + critical "You must provide a version to install the agent from puppetcore on MacOS/Windows." + exit 1 + fi + dots=$(echo "${version}" | grep -o '\.' | wc -l) + if (( dots >= 3 )); then + download_url="${mac_source}?type=native&version=${version}&os_name=osx&os_version=${platform_version}&os_arch=${arch}&dev=true" + else + download_url="${mac_source}?type=native&version=${version}&os_name=osx&os_version=${platform_version}&os_arch=${arch}" + fi + else + download_url="${mac_source}/mac/${collection/core/}/${platform_version}/${arch}/${filename}" + fi ;; *) critical "Sorry $platform is not supported yet!" @@ -1075,7 +1113,7 @@ fi if [[ $PT__noop != true ]]; then download_filename="${tmp_dir}/${filename}" - do_download "$download_url" "$download_filename" + do_download "$download_url" "$download_filename" "$username" "$password" install_file $filetype "$download_filename" diff --git a/modules/puppet_agent b/modules/puppet_agent index 9f8469c..16d966b 160000 --- a/modules/puppet_agent +++ b/modules/puppet_agent @@ -1 +1 @@ -Subproject commit 9f8469c38e6f9f220b5c161357d9660ce45288bb +Subproject commit 16d966be72887dbf1a678a7cc840253df492b2df From 83df7f1ad34dd3cca9ea513a94735ffb06bfef78 Mon Sep 17 00:00:00 2001 From: Saurabh Pandit Date: Thu, 21 May 2026 19:49:11 +0530 Subject: [PATCH 2/2] (PE-43842) Drop puppet_agent submodule bump from this PR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Keep the regenerated install.sh, but revert the submodule pointer to main's recorded 9f8469c. The submodule advance to upstream tip will land in a separate PR. Note: install.sh is regenerated against a newer puppet_agent than this PR records — running ruby install.rb on this branch will produce a different script until the submodule is bumped. Co-Authored-By: Claude Opus 4.7 --- modules/puppet_agent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/puppet_agent b/modules/puppet_agent index 16d966b..9f8469c 160000 --- a/modules/puppet_agent +++ b/modules/puppet_agent @@ -1 +1 @@ -Subproject commit 16d966be72887dbf1a678a7cc840253df492b2df +Subproject commit 9f8469c38e6f9f220b5c161357d9660ce45288bb