File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,16 @@ if (($collection -like '*nightly*') -And -Not ($PSBoundParameters.ContainsKey('w
120
120
$windows_source = ' https://nightlies.puppet.com/downloads'
121
121
} elseif (($collection -like ' *puppetcore*' ) -And -Not ($PSBoundParameters.ContainsKey (' windows_source' ))) {
122
122
$windows_source = ' https://artifacts-puppetcore.puppet.com/v1/download'
123
+
124
+ # Puppetcore requires a version to be specified, so we will use the latest version if not specified.
125
+ # Or if the version is set to "latest".
126
+ if ($version -eq " " || ! $version || $version -eq " latest" ) {
127
+ $version = ((Invoke-WebRequest - Uri " https://forgeapi.puppet.com/private/versions/puppet-agent" - UseBasicParsing).Content
128
+ | ConvertFrom-Json ).PSObject.Properties.Name
129
+ | Where-Object { $_ -like " 8.*" }
130
+ | Sort-Object { [Version ]$_ }
131
+ | Select-Object - Last 1
132
+ }
123
133
}
124
134
125
135
if ($absolute_source ) {
@@ -131,6 +141,7 @@ if ($absolute_source) {
131
141
} else {
132
142
$dev = ' '
133
143
}
144
+
134
145
$msi_source = " ${windows_source} ?type=native&version=${version} &os_name=windows&os_version=${major_os_version} &os_arch=${arch} &fips=${fips}${dev} "
135
146
} else {
136
147
$msi_source = " $windows_source /windows/${collection} /${msi_name} "
Original file line number Diff line number Diff line change @@ -152,6 +152,12 @@ if [ -n "$PT_mac_source" ]; then
152
152
mac_source=$PT_mac_source
153
153
elif [[ " $collection " == " puppetcore" * ]]; then
154
154
mac_source=' https://artifacts-puppetcore.puppet.com/v1/download'
155
+ # Puppetcore requires a version to be specified, so we will use the latest version if not specified.
156
+ # Or if the version is set to "latest".
157
+ if ($version -eq " " || ! $version || $version -eq " latest" ) {
158
+ $version = curl -sL https://forgeapi.puppet.com/private/versions/puppet-agent
159
+ | jq -r ' keys_unsorted | map(select(startswith("8.")))| max_by( split(".") | map(tonumber) )'
160
+ }
155
161
elif [ " $nightly " = true ]; then
156
162
mac_source=' http://nightlies.puppet.com/downloads'
157
163
else
You can’t perform that action at this time.
0 commit comments