@@ -26,6 +26,14 @@ warn () {
26
26
log " WARN: ${1} "
27
27
}
28
28
29
+ url_parameters () {
30
+ if [[ " $version " =~ ^([0-9]+)\. ([0-9]+)\. ([0-9]+)\. ([0-9]+)\. g([a-f0-9]+)$ ]]; then
31
+ echo " &dev=true"
32
+ else
33
+ echo " "
34
+ fi
35
+ }
36
+
29
37
critical () {
30
38
log " CRIT: ${1} "
31
39
}
162
170
if [ -n " $PT_mac_source " ]; then
163
171
mac_source=$PT_mac_source
164
172
else
165
- if [ " $nightly " = true ]; then
166
- mac_source=' http://nightlies.puppet.com/downloads'
167
- else
168
- mac_source=' http://downloads.puppet.com'
173
+ if [[ " $PT_collection " =~ core ]]; then
174
+ if [ -z " $password " ]; then
175
+ echo " A password parameter is required to install with puppetcore"
176
+ exit 1
177
+ fi
178
+ mac_source=' https://artifacts-puppetcore.puppet.com/v1/download'
179
+ else
180
+ if [ " $nightly " = true ]; then
181
+ mac_source=' http://nightlies.puppet.com/downloads'
182
+ else
183
+ mac_source=' http://downloads.puppet.com'
184
+ fi
169
185
fi
170
186
fi
171
187
@@ -421,7 +437,11 @@ do_wget() {
421
437
# do_curl URL FILENAME
422
438
do_curl () {
423
439
info " Trying curl..."
424
- run_cmd " curl -1 -sL -D $tmp_stderr '$1 ' > '$2 '"
440
+ if [[ -n " $3 " && -n " $4 " ]]; then
441
+ run_cmd " curl -1 -sL -u '$3 :$4 ' -D $tmp_stderr '$1 ' > '$2 '"
442
+ else
443
+ run_cmd " curl -1 -sL -D $tmp_stderr '$1 ' > '$2 '"
444
+ fi
425
445
rc=$?
426
446
427
447
# check for 404
@@ -431,6 +451,12 @@ do_curl() {
431
451
unable_to_retrieve_package
432
452
fi
433
453
454
+ grep " HTTP/2 401" $tmp_stderr 2>&1 > /dev/null
455
+ if test $? -eq 0; then
456
+ critical " ERROR 401: Unauthorized access"
457
+ unable_to_retrieve_package
458
+ fi
459
+
434
460
# check for bad return status or empty output
435
461
if test $rc -ne 0 || test ! -s " $2 " ; then
436
462
capture_tmp_stderr " curl"
@@ -557,7 +583,11 @@ do_download() {
557
583
fi
558
584
559
585
if exists curl; then
560
- do_curl $1 $2 && return 0
586
+ if [[ " $collection " =~ core ]]; then
587
+ do_curl $1 $2 " $username " " $password " && return 0
588
+ else
589
+ do_curl $1 $2 && return 0
590
+ fi
561
591
fi
562
592
563
593
if exists fetch; then
@@ -810,19 +840,29 @@ case $platform in
810
840
download_url=" ${apt_source} /${filename} "
811
841
;;
812
842
" mac_os_x" )
813
- info " Mac platform! Lets get you a DMG..."
814
- filetype=" dmg"
843
+ arch=" x86_64"
844
+ if [[ $( uname -p) == " arm" ]]; then
845
+ arch=" arm64"
846
+ fi
815
847
if test " $version " = " latest" ; then
816
848
filename=" puppet-agent-latest.dmg"
817
849
else
818
850
filename=" puppet-agent-${version} -1.osx${platform_version} .dmg"
819
851
fi
852
+ info " Mac platform! Lets get you a DMG...!!"
853
+ if [[ " $collection " =~ core ]]; then
854
+ if [ -z " $password " ]; then
855
+ echo " A password parameter is required to install"
856
+ exit 1
857
+ fi
820
858
821
- arch=" x86_64"
822
- if [[ $( uname -p) == " arm" ]]; then
823
- arch=" arm64"
859
+ # Call the url_parameters function to append to the download_url
860
+ download_url=" ${mac_source} /?version=${version} &os_name=osx&os_version=${platform_version} &os_arch=${arch} &fips=false$( url_parameters) "
861
+ else
862
+ download_url=" ${mac_source} /mac/${collection} /${platform_version} /${arch} /${filename} "
824
863
fi
825
- download_url=" ${mac_source} /mac/${collection} /${platform_version} /${arch} /${filename} "
864
+ filetype=" dmg"
865
+
826
866
;;
827
867
* )
828
868
critical " Sorry $platform is not supported yet!"
0 commit comments