diff --git a/manifests/init.pp b/manifests/init.pp index 6aea56c54..c0c1738ac 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -65,6 +65,7 @@ $install_dir = $::puppet_agent::params::install_dir, $disable_proxy = false, $install_options = $::puppet_agent::params::install_options, + $skip_if_unavailable = 'absent', $msi_move_locked_files = false, ) inherits ::puppet_agent::params { diff --git a/manifests/osfamily/redhat.pp b/manifests/osfamily/redhat.pp index 38b509bf9..c2601d1a1 100644 --- a/manifests/osfamily/redhat.pp +++ b/manifests/osfamily/redhat.pp @@ -4,6 +4,7 @@ assert_private() $pa_collection = getvar('::puppet_agent::collection') + $skip_if_unavailable = getvar('::puppet_agent::skip_if_unavailable') if $::operatingsystem == 'Fedora' { if $pa_collection == 'PC1' { @@ -111,15 +112,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, } } } diff --git a/spec/classes/puppet_agent_osfamily_redhat_spec.rb b/spec/classes/puppet_agent_osfamily_redhat_spec.rb index 7dd9b9ee5..4bd4e2d12 100644 --- a/spec/classes/puppet_agent_osfamily_redhat_spec.rb +++ b/spec/classes/puppet_agent_osfamily_redhat_spec.rb @@ -159,6 +159,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) { @@ -172,6 +173,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