Skip to content

Commit d394b6d

Browse files
committed
Download puppet8 packages from yum-puppetcore.puppet.com
Add optional `username` and `password` class parameters to init.pp Change default `yum_source` parameter from http://yum.puppet.com to https://yum-support.puppet.com. Note the change to HTTPS.
1 parent e629f5c commit d394b6d

File tree

4 files changed

+28
-6
lines changed

4 files changed

+28
-6
lines changed

manifests/init.pp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
# The exact location of the package to install. The entire path to the package must be
3535
# provided with this parameter.
3636
# @param yum_source
37-
# Base URL of the location of mirrors of yum.puppet.com downloads sites. Directories under
38-
# the URL "yum_source" should match the structure of the yum.puppet.com
37+
# Base URL of the location of mirrors of yum-puppetcore.puppet.com downloads sites. Directories under
38+
# the URL "yum_source" should match the structure of the yum-puppetcore.puppet.com
3939
# @param apt_source
4040
# Base URL of the location of mirrors of apt.puppet.com downloads sites. Directories under
4141
# the URL "apt_source" should match the structure of the apt.puppet.com
@@ -114,7 +114,7 @@
114114
Array $service_names = $puppet_agent::params::service_names,
115115
Optional $source = undef,
116116
Optional $absolute_source = undef,
117-
String $yum_source = 'http://yum.puppet.com',
117+
String $yum_source = 'https://yum-puppetcore.puppet.com',
118118
String $apt_source = 'https://apt.puppet.com',
119119
String $mac_source = 'https://downloads.puppet.com',
120120
String $windows_source = 'https://downloads.puppet.com',
@@ -131,7 +131,9 @@
131131
Optional $wait_for_pxp_agent_exit = undef,
132132
Optional $wait_for_puppet_run = undef,
133133
Array[Puppet_agent::Config] $config = [],
134-
Stdlib::Absolutepath $version_file_path = '/opt/puppetlabs/puppet/VERSION'
134+
Stdlib::Absolutepath $version_file_path = '/opt/puppetlabs/puppet/VERSION',
135+
Optional $username = undef,
136+
Optional[Sensitive] $password = undef,
135137
) inherits puppet_agent::params {
136138
# The configure class uses $puppet_agent::config to manage settings in
137139
# puppet.conf, and will always be present. It does not require management of

manifests/osfamily/redhat.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@
175175
sslclientcert => $_sslclientcert_path,
176176
sslclientkey => $_sslclientkey_path,
177177
skip_if_unavailable => $puppet_agent::skip_if_unavailable,
178+
username => $puppet_agent::username,
179+
password => $puppet_agent::password,
178180
}
179181
}
180182
}

spec/classes/puppet_agent_osfamily_redhat_spec.rb

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
is_expected.to contain_yumrepo('pc_repo')
152152
.with({
153153
# We no longer expect the 'f' in fedora repos
154-
'baseurl' => "http://yum.puppet.com/puppet5/#{urlbit.gsub('/f', '/')}/#{arch}",
154+
'baseurl' => "https://yum-puppetcore.puppet.com/puppet5/#{urlbit.gsub('/f', '/')}/#{arch}",
155155
'enabled' => 'true',
156156
'gpgcheck' => '1',
157157
'gpgkey' => "file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppet\n file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-20250406",
@@ -261,6 +261,24 @@
261261
is_expected.to contain_yumrepo('pc_repo').with_skip_if_unavailable(true)
262262
}
263263
end
264+
describe 'with credentials' do
265+
let(:params) do
266+
{
267+
manage_repo: true,
268+
package_version: package_version,
269+
username: 'forge-key',
270+
password: sensitive('open-sesame'),
271+
}
272+
end
273+
274+
it {
275+
is_expected.to contain_yumrepo('pc_repo')
276+
.with(
277+
username: 'forge-key',
278+
password: sensitive('open-sesame'),
279+
)
280+
}
281+
end
264282
end
265283

266284
context 'with manage_repo disabled' do

spec/classes/puppet_agent_osfamily_suse_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@
151151
'enabled' => '1',
152152
'gpgcheck' => '1',
153153
'autorefresh' => '0',
154-
'baseurl' => "http://yum.puppet.com/puppet6/sles/#{os_version}/x86_64?ssl_verify=no",
154+
'baseurl' => "https://yum-puppetcore.puppet.com/puppet6/sles/#{os_version}/x86_64?ssl_verify=no",
155155
'type' => 'rpm-md',
156156
}.each do |setting, value|
157157
it {

0 commit comments

Comments
 (0)