Skip to content

Commit 1c93b70

Browse files
committed
Add class to configure generating certificates
1 parent b9667a0 commit 1c93b70

File tree

2 files changed

+119
-0
lines changed

2 files changed

+119
-0
lines changed

manifests/generate.pp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Handles generating certificates
2+
#
3+
# === Parameters:
4+
#
5+
# $apache:: Generates certificates needed by Apache
6+
#
7+
# $foreman:: Generates certificates needed by Foreman
8+
#
9+
# $candlepin:: Generates certificates needed by Candlepin
10+
#
11+
# $foreman_proxy:: Generates certificates needed by Foreman Proxy
12+
#
13+
# $puppet:: Generates certificates needed by Puppet
14+
#
15+
class certs::generate (
16+
Boolean $apache = false,
17+
Boolean $foreman = false,
18+
Boolean $candlepin = false,
19+
Boolean $foreman_proxy = false,
20+
Boolean $puppet = false,
21+
) {
22+
23+
if $certs::generate::apache {
24+
include certs::apache
25+
}
26+
27+
if $certs::generate::foreman {
28+
include certs::foreman
29+
}
30+
31+
if $certs::generate::candlepin {
32+
include certs::candlepin
33+
}
34+
35+
if $certs::generate::foreman_proxy {
36+
include certs::foreman_proxy
37+
}
38+
39+
40+
if $certs::generate::puppet {
41+
include certs::puppet
42+
}
43+
44+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
require 'spec_helper'
2+
3+
describe 'certs::generate' do
4+
on_supported_os.each do |os, os_facts|
5+
context "on #{os}" do
6+
let :facts do
7+
os_facts
8+
end
9+
10+
describe 'with default parameters' do
11+
it { should compile.with_all_deps }
12+
end
13+
14+
describe 'with apache true' do
15+
let :pre_condition do
16+
"class {'certs::generate': apache => true,}"
17+
end
18+
19+
it { should compile.with_all_deps }
20+
21+
it do
22+
is_expected.to contain_class('certs::apache')
23+
end
24+
end
25+
26+
describe 'with foreman true' do
27+
let :pre_condition do
28+
"class {'certs::generate': foreman => true,}"
29+
end
30+
31+
it { should compile.with_all_deps }
32+
33+
it do
34+
is_expected.to contain_class('certs::foreman')
35+
end
36+
end
37+
38+
describe 'with candlepin true' do
39+
let :pre_condition do
40+
"class {'certs::generate': candlepin => true,}"
41+
end
42+
43+
it { should compile.with_all_deps }
44+
45+
it do
46+
is_expected.to contain_class('certs::candlepin')
47+
end
48+
end
49+
50+
describe 'with foreman_proxy true' do
51+
let :pre_condition do
52+
"class {'certs::generate': foreman_proxy => true,}"
53+
end
54+
55+
it { should compile.with_all_deps }
56+
57+
it do
58+
is_expected.to contain_class('certs::foreman_proxy')
59+
end
60+
end
61+
62+
describe 'with puppet true' do
63+
let :pre_condition do
64+
"class {'certs::generate': puppet => true,}"
65+
end
66+
67+
it { should compile.with_all_deps }
68+
69+
it do
70+
is_expected.to contain_class('certs::puppet')
71+
end
72+
end
73+
end
74+
end
75+
end

0 commit comments

Comments
 (0)