Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MODULES-4424) Add skip_if_unavailable to yumrepo resource #205

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
$install_dir = $::puppet_agent::params::install_dir,
$disable_proxy = false,
$install_options = $::puppet_agent::params::install_options,
$skip_if_unavailable = 'absent',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have a yumrepo hash, that lets you override any particular parameters to setting up the repo... although that also sounds terrible.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this would be easy to do with the splat operator, but we'd have to wait until Puppet 3 support is dropped.

CLA signed.

$msi_move_locked_files = false,
) inherits ::puppet_agent::params {

Expand Down
20 changes: 11 additions & 9 deletions manifests/osfamily/redhat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}

$pa_collection = getvar('::puppet_agent::collection')
$skip_if_unavailable = getvar('::puppet_agent::skip_if_unavailable')

if getvar('::puppet_agent::is_pe') == true {
# In Puppet Enterprise, agent packages are served by the same server
Expand Down Expand Up @@ -99,15 +100,16 @@
default => undef,
}
yumrepo { 'pc_repo':
baseurl => $source,
descr => "Puppet Labs ${pa_collection} Repository",
enabled => true,
gpgcheck => '1',
gpgkey => "${gpg_keys}",
proxy => $_proxy,
sslcacert => $_sslcacert_path,
sslclientcert => $_sslclientcert_path,
sslclientkey => $_sslclientkey_path,
baseurl => $source,
descr => "Puppet Labs ${pa_collection} Repository",
enabled => true,
gpgcheck => '1',
gpgkey => "${gpg_keys}",
proxy => $_proxy,
sslcacert => $_sslcacert_path,
sslclientcert => $_sslclientcert_path,
sslclientkey => $_sslclientkey_path,
skip_if_unavailable => $skip_if_unavailable,
}
}
}
13 changes: 13 additions & 0 deletions spec/classes/puppet_agent_osfamily_redhat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
'sslcacert' => '/etc/puppetlabs/puppet/ssl/certs/ca.pem',
'sslclientcert' => '/etc/puppetlabs/puppet/ssl/certs/foo.example.vm.pem',
'sslclientkey' => '/etc/puppetlabs/puppet/ssl/private_keys/foo.example.vm.pem',
'skip_if_unavailable' => 'absent',
}) }
describe 'disable proxy' do
let(:params) {
Expand All @@ -148,6 +149,18 @@
is_expected.to contain_yumrepo('pc_repo').with_proxy('_none_')
}
end
describe 'skip repo if unavailable' do
let(:params) {
{
:manage_repo => true,
:package_version => package_version,
:skip_if_unavailable => true,
}
}
it {
is_expected.to contain_yumrepo('pc_repo').with_skip_if_unavailable(true)
}
end
end

context 'with manage_repo disabled' do
Expand Down