-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't run enable_ca_trust on EL7 (#40)
`update-ca-trust` ignores all arguments on EL7 so `update-ca-trust enable` and even `update-ca-trust check` (from the unless parameter) actually perform an update. Fixes #GH-38
- Loading branch information
1 parent
3d0e5ff
commit 3b916df
Showing
7 changed files
with
55 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
fixtures: | ||
repositories: | ||
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" | ||
remote_file: "git://github.com/lwf/puppet-remote_file.git" | ||
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" | ||
remote_file: "https://github.com/lwf/puppet-remote_file.git" | ||
symlinks: | ||
ca_cert: "#{source_dir}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ | |
let :facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
:operatingsystemrelease => '7.0' | ||
} | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,81 +1,47 @@ | ||
require 'spec_helper' | ||
|
||
describe 'ca_cert::update', :type => :class do | ||
|
||
shared_examples 'compiles and includes params class' do | ||
it { should compile } | ||
it { should contain_class('ca_cert::params') } | ||
end | ||
|
||
context "on a Debian based OS" do | ||
let :facts do | ||
{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Ubuntu' | ||
} | ||
end | ||
|
||
it_behaves_like 'compiles and includes params class' do | ||
end | ||
it { is_expected.not_to contain_exec('enable_ca_trust') } | ||
it { is_expected.to contain_exec('ca_cert_update').with( | ||
:command => 'update-ca-certificates', | ||
:refreshonly => true, | ||
)} | ||
|
||
end | ||
context "on a RedHat based OS" do | ||
let :facts do | ||
{ | ||
:osfamily => 'RedHat', | ||
} | ||
end | ||
|
||
it_behaves_like 'compiles and includes params class' do | ||
end | ||
it { is_expected.to contain_exec('enable_ca_trust').with( | ||
:command => 'update-ca-trust enable', | ||
) } | ||
it { is_expected.to contain_exec('ca_cert_update').with( | ||
:command => 'update-ca-trust extract', | ||
:refreshonly => true, | ||
)} | ||
|
||
end | ||
['10','11'].each do |osmajrel| | ||
context "on a Suse #{osmajrel} based OS" do | ||
let :facts do | ||
{ | ||
:osfamily => 'Suse', | ||
:operatingsystemmajrelease => "#{osmajrel}", | ||
} | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
|
||
it_behaves_like 'compiles and includes params class' do | ||
it { is_expected.to compile.with_all_deps } | ||
it { is_expected.to contain_class('ca_cert::params') } | ||
|
||
case facts[:osfamily] | ||
when 'Debian' | ||
it { is_expected.not_to contain_exec('enable_ca_trust') } | ||
it { is_expected.to contain_exec('ca_cert_update').with( | ||
:command => 'update-ca-certificates', | ||
:refreshonly => true, | ||
)} | ||
when 'RedHat' | ||
if facts[:operatingsystemrelease] == '7.0' | ||
it { is_expected.not_to contain_exec('enable_ca_trust') } | ||
else | ||
it { is_expected.to contain_exec('enable_ca_trust').with_command('update-ca-trust enable') } | ||
end | ||
it { is_expected.to contain_exec('ca_cert_update').with( | ||
:command => 'update-ca-trust extract', | ||
:refreshonly => true, | ||
)} | ||
when 'Suse' | ||
it { is_expected.not_to contain_exec('enable_ca_trust') } | ||
case facts[:operatingsystemmajrelease] | ||
when '10','11' | ||
it { is_expected.to contain_exec('ca_cert_update').with( | ||
:command => 'c_rehash', | ||
:refreshonly => true, | ||
)} | ||
when '12','13','42' | ||
it { is_expected.to contain_exec('ca_cert_update').with( | ||
:command => 'update-ca-certificates', | ||
:refreshonly => true, | ||
)} | ||
end | ||
end | ||
it { is_expected.not_to contain_exec('enable_ca_trust') } | ||
it { is_expected.to contain_exec('ca_cert_update').with( | ||
:command => 'c_rehash', | ||
:refreshonly => true, | ||
)} | ||
|
||
end | ||
end | ||
context "on a Suse 12 based OS" do | ||
let :facts do | ||
{ | ||
:osfamily => 'Suse', | ||
:operatingsystemmajrelease => '12', | ||
} | ||
end | ||
|
||
it_behaves_like 'compiles and includes params class' do | ||
end | ||
it { is_expected.not_to contain_exec('enable_ca_trust') } | ||
it { is_expected.to contain_exec('ca_cert_update').with( | ||
:command => 'update-ca-certificates', | ||
:refreshonly => true, | ||
)} | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,7 @@ | |
{ | ||
:osfamily => 'RedHat', | ||
:operatingsystem => 'RedHat', | ||
:operatingsystemrelease => '7.0' | ||
} | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters