Skip to content

Commit

Permalink
Add class to configure generating certificates
Browse files Browse the repository at this point in the history
  • Loading branch information
ehelms committed Apr 30, 2024
1 parent b9667a0 commit 7103174
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
41 changes: 41 additions & 0 deletions manifests/generate.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Handles generating certificates
#
# === Parameters:
#
# $apache:: Generates certificates needed by Apache
#
# $foreman:: Generates certificates needed by Foreman
#
# $candlepin:: Generates certificates needed by Candlepin
#
# $foreman_proxy:: Generates certificates needed by Foreman Proxy
#
# $puppet:: Generates certificates needed by Puppet
#
class certs::generate (
Boolean $apache = false,
Boolean $foreman = false,
Boolean $candlepin = false,
Boolean $foreman_proxy = false,
Boolean $puppet = false,
) {
if $certs::generate::apache {
include certs::apache
}

if $certs::generate::foreman {
include certs::foreman
}

if $certs::generate::candlepin {
include certs::candlepin
}

if $certs::generate::foreman_proxy {
include certs::foreman_proxy
}

if $certs::generate::puppet {
include certs::puppet
}
}
75 changes: 75 additions & 0 deletions spec/classes/certs_generate_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
require 'spec_helper'

describe 'certs::generate' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
os_facts
end

describe 'with default parameters' do
it { should compile.with_all_deps }
end

describe 'with apache true' do
let :pre_condition do
"class {'certs::generate': apache => true,}"
end

it { should compile.with_all_deps }

it do
is_expected.to contain_class('certs::apache')
end
end

describe 'with foreman true' do
let :pre_condition do
"class {'certs::generate': foreman => true,}"
end

it { should compile.with_all_deps }

it do
is_expected.to contain_class('certs::foreman')
end
end

describe 'with candlepin true' do
let :pre_condition do
"class {'certs::generate': candlepin => true,}"
end

it { should compile.with_all_deps }

it do
is_expected.to contain_class('certs::candlepin')
end
end

describe 'with foreman_proxy true' do
let :pre_condition do
"class {'certs::generate': foreman_proxy => true,}"
end

it { should compile.with_all_deps }

it do
is_expected.to contain_class('certs::foreman_proxy')
end
end

describe 'with puppet true' do
let :pre_condition do
"class {'certs::generate': puppet => true,}"
end

it { should compile.with_all_deps }

it do
is_expected.to contain_class('certs::puppet')
end
end
end
end
end

0 comments on commit 7103174

Please sign in to comment.