Skip to content

Commit

Permalink
rename {owner,group}_id params to {owner,group}
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Hoblitt committed Feb 10, 2014
1 parent 1be0034 commit 991b4c7
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 35 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ and key via PEM files.

```
nssdb::create { '/etc/dirsrv/slapd-ldap1':
owner_id => 'nobody',
group_id => 'nobody',
owner => 'nobody',
group => 'nobody',
mode => '0660',
password => 'example',
manage_certdir => false,
}
nssdb::add_cert_and_key{ '/etc/dirsrv/slapd-ldap1':
certdir => '/etc/dirsrv/slapd-ldap1',
nickname => 'Server-Cert',
cert => '/tmp/foo.pem',
key => '/tmp/foo.key',
Expand Down
12 changes: 6 additions & 6 deletions manifests/add_cert.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# Parameters:
# $nickname - required - the nickname for the NSS certificate
# $cert - required - path to certificate in PEM format
# $certdir - optional - defaults to $title
# $cert - optional - path to certificate in PEM format
# $certdir - required - defaults to $title
# $trustargs - optional - defaults to 'CT,,'
#
# Actions:
Expand All @@ -15,15 +15,15 @@
#
# Sample Usage:
#
# nssdb::add_cert { '/etc/pki/foo':
# nssdb::add_cert { '/tmp/server.crt':
# nickname => 'GlobalSign Root CA',
# cert => '/tmp/server.crt',
# certdir => '/etc/pki/foo',
# }
#
define nssdb::add_cert(
$nickname,
$cert,
$certdir = $title,
$cert = $title,
$certdir,
$trustargs = 'CT,,'
) {
include nssdb
Expand Down
28 changes: 14 additions & 14 deletions manifests/create.pp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Create an empty NSS database with a password file.
#
# Parameters:
# $owner_id - required - the file/directory user
# $group_id - required - the file/directory group
# $owner - required - the file/directory user
# $group - required - the file/directory group
# $password - required - password to set on the database
# $mode - optional - defaults to '0600'
# $certdir_mode - optional - defaults to '0700'
Expand All @@ -12,22 +12,22 @@
# cert8.db, key3.db, secmod.db and a password file, password.conf
#
# Requires:
# $owner_id must be set
# $group_id must be set
# $owner must be set
# $group must be set
# $password must be set
#
# Sample Usage:
#
# nssdb::create {'test':
# owner_id => 'qpidd',
# group_id => 'qpidd',
# owner => 'qpidd',
# group => 'qpidd',
# password => 'test'}
#
# This will create an NSS database in /etc/pki/test
#
define nssdb::create (
$owner_id,
$group_id,
$owner,
$group,
$password,
$mode = '0600',
$certdir_mode = '0700',
Expand All @@ -42,8 +42,8 @@
file { $certdir:
ensure => directory,
mode => $certdir_mode,
owner => $owner_id,
group => $group_id,
owner => $owner,
group => $group,
}

$require_certdir = File[$certdir]
Expand All @@ -55,8 +55,8 @@
file { "${certdir}/password.conf":
ensure => file,
mode => $mode,
owner => $owner_id,
group => $group_id,
owner => $owner,
group => $group,
content => $password,
require => $require_certdir,
}
Expand All @@ -68,8 +68,8 @@
]:
ensure => file,
mode => $mode,
owner => $owner_id,
group => $group_id,
owner => $owner,
group => $group,
require => [
File["${certdir}/password.conf"],
Exec["create_nss_db_${title}"],
Expand Down
1 change: 1 addition & 0 deletions spec/defines/nssdb_add_cert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{
:nickname => 'GlobalSign Root CA',
:cert => '/tmp/server.crt',
:certdir => '/dne',
}
end

Expand Down
10 changes: 5 additions & 5 deletions spec/defines/nssdb_create_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
let(:title) { '/obsolete' }
let(:params) do
{
:owner_id => 'nobody',
:group_id => 'nobody',
:password => 'secret',
:owner => 'nobody',
:group => 'nobody',
:password => 'secret',
}
end

Expand Down Expand Up @@ -72,8 +72,8 @@
let(:title) { '/obsolete' }
let(:params) do
{
:owner_id => 'nobody',
:group_id => 'nobody',
:owner => 'nobody',
:group => 'nobody',
:mode => '0660',
:password => 'secret',
:manage_certdir => false,
Expand Down
13 changes: 5 additions & 8 deletions tests/create.pp
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
# NOTE: This requires that the directory /tmp/nssdb already exists

# Create a test database owned by the user rcrit
nssdb::create {'test':
owner_id => 'rcrit',
group_id => 'rcrit',
nssdb::create { '/tmp/nssdb':
owner => 'rcrit',
group => 'rcrit',
password => 'test',
cacert => '/etc/ipa/ca.crt',
catrust => 'CT,,',
basedir => '/tmp/nssdb',
}

# Add a certificate and private key from PEM fiels
nssdb::add_cert_and_key {'test':
nssdb::add_cert_and_key { 'test':
certdir => '/tmp/nssdb',
cert => '/tmp/cert.pem',
key => '/tmp/key.pem',
nickname => 'test',
basedir => '/tmp/nssdb',
}

# You can confirm that things are loaded properly with:
Expand Down

0 comments on commit 991b4c7

Please sign in to comment.