From 8833880e899373c36b1eea9765c687ca1a28dd99 Mon Sep 17 00:00:00 2001 From: david22swan Date: Wed, 30 Jul 2025 10:01:30 +0100 Subject: [PATCH] (CAT-2413) Install tasks require version to install on MacOS/Windows Set an error message to be given if the version is not received when necessary. --- tasks/install_powershell.ps1 | 3 +++ tasks/install_shell.sh | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tasks/install_powershell.ps1 b/tasks/install_powershell.ps1 index 21f54601..7d6134b5 100644 --- a/tasks/install_powershell.ps1 +++ b/tasks/install_powershell.ps1 @@ -122,6 +122,9 @@ if (($collection -like '*puppetcore*-nightly*') -And -Not ($PSBoundParameters.Co $windows_source = 'https://nightlies.puppet.com/downloads' } elseif (($collection -like '*puppetcore*') -And -Not ($PSBoundParameters.ContainsKey('windows_source'))) { $windows_source = 'https://artifacts-puppetcore.puppet.com/v1/download' + if ($version -eq "" -Or !$version) { + Throw "You must provide a version to install the agent from puppetcore on Windows/MacOS." + } } if ($absolute_source) { diff --git a/tasks/install_shell.sh b/tasks/install_shell.sh index 11f02131..e0ec0681 100644 --- a/tasks/install_shell.sh +++ b/tasks/install_shell.sh @@ -841,11 +841,15 @@ case $platform in arch="arm64" fi if [[ "$collection" =~ "puppetcore" ]]; 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}?version=${version}&os_name=osx&os_version=${platform_version}&os_arch=${arch}&dev=true" + 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}?version=${version}&os_name=osx&os_version=${platform_version}&os_arch=${arch}" + 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}/${platform_version}/${arch}/${filename}"