Skip to content

Commit 79631c2

Browse files
committed
Update install_shell for rpm platforms
1 parent d394b6d commit 79631c2

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

tasks/install.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@
4141
"description": "The number of retries in case of network connectivity failures",
4242
"type": "Optional[Integer]",
4343
"default": 5
44+
},
45+
"username": {
46+
"description": "The username to use when downloading from a source location requiring authentication",
47+
"type": "Optional[String]"
48+
},
49+
"password": {
50+
"description": "The password to use when downloading from a source location requiring authentication",
51+
"type": "Optional[String]"
4452
}
4553
},
4654
"implementations": [

tasks/install_shell.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
"description": "The number of retries in case of network connectivity failures",
4444
"type": "Optional[Integer]",
4545
"default": 5
46+
},
47+
"username": {
48+
"description": "The username to use when downloading from a source location requiring authentication",
49+
"type": "Optional[String]"
50+
},
51+
"password": {
52+
"description": "The password to use when downloading from a source location requiring authentication",
53+
"type": "Optional[String]"
4654
}
4755
},
4856
"files": ["facts/tasks/bash.sh"],

tasks/install_shell.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ if [ -n "$PT_version" ]; then
100100
version=$PT_version
101101
fi
102102

103+
if [ -n "$PT_username" ]; then
104+
username=$PT_username
105+
else
106+
username="forge-key"
107+
fi
108+
109+
if [ -n "$PT_password" ]; then
110+
password=$PT_password
111+
fi
112+
103113
if [ -n "$PT_collection" ]; then
104114
# Check whether collection is nightly
105115
if [[ "$PT_collection" == *"nightly"* ]]; then
@@ -110,7 +120,7 @@ if [ -n "$PT_collection" ]; then
110120

111121
collection=$PT_collection
112122
else
113-
collection='puppet'
123+
collection='puppet8'
114124
fi
115125

116126
if [ -n "$PT_yum_source" ]; then
@@ -119,7 +129,11 @@ else
119129
if [ "$nightly" = true ]; then
120130
yum_source='https://artifactory.delivery.puppetlabs.net:443/artifactory/internal_nightly__local/yum'
121131
else
122-
yum_source='http://yum.puppet.com'
132+
yum_source='https://yum-puppetcore.puppet.com/public'
133+
if [ -z "$password" ]; then
134+
echo "A password parameter is required to install from ${yum_source}"
135+
exit 1
136+
fi
123137
fi
124138
fi
125139

@@ -583,6 +597,8 @@ install_file() {
583597
fi
584598

585599
rpm -Uvh --oldpackage --replacepkgs "$2"
600+
sed -i "s/^#\?username=.*/username=${username}/" "/etc/yum.repos.d/puppet8-release.repo"
601+
sed -i "s/^#\?password=.*/password=${password}/" "/etc/yum.repos.d/puppet8-release.repo"
586602
exists dnf && PKGCMD=dnf || PKGCMD=yum
587603
if test "$version" = 'latest'; then
588604
run_cmd "${PKGCMD} install -y puppet-agent && ${PKGCMD} upgrade -y puppet-agent"
@@ -606,7 +622,7 @@ install_file() {
606622
fi
607623
fi
608624

609-
run_cmd "zypper install --no-confirm '$2'"
625+
sed -i 's/^baseurl/baseurl=https:\/\/${username}:${password}@yum-puppetcore.puppet.com\/puppet8\/sles\/\$basearch?auth=basic' "/etc/zypp/repos.d/puppet8-release.repo"
610626
if test "$version" = "latest"; then
611627
run_cmd "zypper install --no-confirm 'puppet-agent'"
612628
else
@@ -669,9 +685,9 @@ case $platform in
669685
info "SLES platform! Lets get you an RPM..."
670686

671687
if [[ $PT__noop != true ]]; then
672-
for key in "puppet" "puppet-20250406"; do
688+
for key in "puppet-20250406"; do
673689
gpg_key="${tmp_dir}/RPM-GPG-KEY-${key}"
674-
do_download "https://yum.puppet.com/RPM-GPG-KEY-${key}" "$gpg_key"
690+
do_download "https://yum-puppetcore.puppet.com/public/RPM-GPG-KEY-${key}" "$gpg_key"
675691
rpm --import "$gpg_key"
676692
rm -f "$gpg_key"
677693
done

0 commit comments

Comments
 (0)