This repository has been archived by the owner on Dec 31, 2024. It is now read-only.
forked from jhoblitt/puppet-nsstools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change nssdb::add_cert_and_key type to treat it's title as the defaul…
…t nickname Previously, the title was being used as the default certdir param value.
- Loading branch information
Joshua Hoblitt
committed
Feb 10, 2014
1 parent
7ea6c6a
commit ee1b60e
Showing
4 changed files
with
90 additions
and
51 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
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,43 +1,86 @@ | ||
require 'spec_helper' | ||
|
||
describe 'nssdb::add_cert_and_key', :type => :define do | ||
let(:title) { '/dne' } | ||
let(:params) do | ||
{ | ||
:nickname => 'Server-Cert', | ||
:cert => '/tmp/server.cert', | ||
:key => '/tmp/server.key', | ||
} | ||
end | ||
context 'default params' do | ||
let(:title) { 'Server-Cert' } | ||
let(:params) do | ||
{ | ||
:certdir => '/dne', | ||
:cert => '/tmp/server.cert', | ||
:key => '/tmp/server.key', | ||
} | ||
end | ||
|
||
context 'generate_pkcs12' do | ||
it do | ||
should contain_exec('generate_pkcs12_Server-Cert').with( | ||
:command => "/usr/bin/openssl pkcs12 -export -in /tmp/server.cert -inkey /tmp/server.key -password 'file:/dne/password.conf' -out '/dne/server-cert.p12' -name 'Server-Cert'", | ||
:require => [ | ||
'Nssdb::Create[/dne]', | ||
'Class[Nssdb]' | ||
], | ||
:creates => '/dne/server-cert.p12', | ||
:subscribe => 'File[/dne/password.conf]' | ||
) | ||
end | ||
end | ||
|
||
context 'generate_pkcs12' do | ||
it do | ||
should contain_exec('generate_pkcs12_/dne').with( | ||
:command => "/usr/bin/openssl pkcs12 -export -in /tmp/server.cert -inkey /tmp/server.key -password 'file:/dne/password.conf' -out '/dne/server-cert.p12' -name 'Server-Cert'", | ||
:require => [ | ||
'Nssdb::Create[/dne]', | ||
'Class[Nssdb]' | ||
], | ||
:creates => '/dne/server-cert.p12', | ||
:subscribe => 'File[/dne/password.conf]' | ||
) | ||
context 'add_pkcs12' do | ||
it do | ||
should contain_exec('add_pkcs12_Server-Cert').with( | ||
:path => ['/usr/bin'], | ||
:command => "pk12util -d /dne -i /dne/server-cert.p12 -w /dne/password.conf -k /dne/password.conf", | ||
:unless => "certutil -d /dne -L -n 'Server-Cert'", | ||
:logoutput => true, | ||
:require => [ | ||
'Exec[generate_pkcs12_Server-Cert]', | ||
'Nssdb::Create[/dne]', | ||
'Class[Nssdb]' | ||
] | ||
) | ||
end | ||
end | ||
end | ||
end # default params | ||
|
||
context 'add_pkcs12' do | ||
it do | ||
should contain_exec('add_pkcs12_/dne').with( | ||
:path => ['/usr/bin'], | ||
:command => "pk12util -d /dne -i /dne/server-cert.p12 -w /dne/password.conf -k /dne/password.conf", | ||
:unless => "certutil -d /dne -L -n 'Server-Cert'", | ||
:logoutput => true, | ||
:require => [ | ||
'Exec[generate_pkcs12_/dne]', | ||
'Nssdb::Create[/dne]', | ||
'Class[Nssdb]' | ||
] | ||
) | ||
context 'all params' do | ||
let(:title) { 'foo' } | ||
let(:params) do | ||
{ | ||
:nickname => 'Server-Cert', | ||
:certdir => '/dne', | ||
:cert => '/tmp/server.cert', | ||
:key => '/tmp/server.key', | ||
} | ||
end | ||
end | ||
|
||
context 'generate_pkcs12' do | ||
it do | ||
should contain_exec('generate_pkcs12_foo').with( | ||
:command => "/usr/bin/openssl pkcs12 -export -in /tmp/server.cert -inkey /tmp/server.key -password 'file:/dne/password.conf' -out '/dne/server-cert.p12' -name 'Server-Cert'", | ||
:require => [ | ||
'Nssdb::Create[/dne]', | ||
'Class[Nssdb]' | ||
], | ||
:creates => '/dne/server-cert.p12', | ||
:subscribe => 'File[/dne/password.conf]' | ||
) | ||
end | ||
end | ||
|
||
context 'add_pkcs12' do | ||
it do | ||
should contain_exec('add_pkcs12_foo').with( | ||
:path => ['/usr/bin'], | ||
:command => "pk12util -d /dne -i /dne/server-cert.p12 -w /dne/password.conf -k /dne/password.conf", | ||
:unless => "certutil -d /dne -L -n 'Server-Cert'", | ||
:logoutput => true, | ||
:require => [ | ||
'Exec[generate_pkcs12_foo]', | ||
'Nssdb::Create[/dne]', | ||
'Class[Nssdb]' | ||
] | ||
) | ||
end | ||
end | ||
end # all params | ||
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