forked from jhoblitt/puppet-nsstools
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
do not directly manage openssl package
Add require_openssl param to nssdb class to enable/disable requiring the `openssl` class.
- Loading branch information
Joshua Hoblitt
committed
Feb 10, 2014
1 parent
5f4ea61
commit 258a04e
Showing
8 changed files
with
78 additions
and
6 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,7 +1,8 @@ | ||
fixtures: | ||
repositories: | ||
'stdlib': | ||
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git' | ||
repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' | ||
ref: '4.0.0' | ||
'openssl': 'https://github.com/camptocamp/puppet-openssl.git' | ||
symlinks: | ||
nssdb: "#{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 |
---|---|---|
@@ -1,4 +1,11 @@ | ||
# this class should be considered private | ||
class nssdb::params { | ||
$package_name = ['nss-tools', 'openssl'] | ||
case $::osfamily { | ||
'redhat': { | ||
$package_name = ['nss-tools'] | ||
} | ||
default: { | ||
fail("Module ${module_name} is not supported on ${::operatingsystem}") | ||
} | ||
} | ||
} |
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,53 @@ | ||
require 'spec_helper' | ||
|
||
describe 'nssdb', :type => :class do | ||
it { should contain_package('nss-tools') } | ||
it { should contain_package('openssl') } | ||
describe 'on osfamily RedHat' do | ||
let(:facts) {{ :osfamily => 'RedHat' }} | ||
|
||
context 'default params' do | ||
# rspec-puppet relationship matchers seem to be buggy in 1.0.1 | ||
# it { should contain_class('openssl').that_comes_before('Class[nssdb]') } | ||
it { should contain_class('openssl') } | ||
it { should contain_package('nss-tools') } | ||
end # default params | ||
|
||
context 'require_openssl =>' do | ||
context 'true' do | ||
let(:params) {{ :require_openssl => true }} | ||
|
||
it { should contain_class('openssl') } | ||
it { should contain_package('nss-tools') } | ||
end | ||
|
||
context 'false' do | ||
let(:params) {{ :require_openssl => false }} | ||
|
||
it { should_not contain_class('openssl') } | ||
it { should contain_package('nss-tools') } | ||
end | ||
|
||
context 'foo' do | ||
let(:params) {{ :require_openssl => 'foo' }} | ||
|
||
it 'should fail' do | ||
expect { should contain_class('nssdb') }. | ||
to raise_error(/not a boolean./) | ||
end | ||
end | ||
end # default params | ||
end # on osfamily RedHat | ||
|
||
describe 'unsupported osfamily' do | ||
let :facts do | ||
{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Debian', | ||
} | ||
end | ||
|
||
it 'should fail' do | ||
expect { should compile }.to raise_error(/not supported on Debian/) | ||
end | ||
end # unsupported osfamily | ||
|
||
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
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