Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move client_certname to [main] #681

Merged
merged 1 commit into from
Feb 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions manifests/agent/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
'postrun_command': value => $::puppet::postrun_command;
}
}
if $::puppet::client_certname {
puppet::config::agent {
'certname': value => $::puppet::client_certname;
}
}

$::puppet::agent_additional_settings.each |$key,$value| {
puppet::config::agent { $key: value => $value }
Expand Down
6 changes: 6 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$srv_domain = $::puppet::srv_domain,
$use_srv_records = $::puppet::use_srv_records,
$additional_settings = $::puppet::additional_settings,
$client_certname = $::puppet::client_certname,
) {
puppet::config::main{
'vardir': value => $::puppet::vardir;
Expand Down Expand Up @@ -63,6 +64,11 @@
if $syslogfacility and !empty($syslogfacility) {
puppet::config::main{'syslogfacility': value => $syslogfacility; }
}
if $client_certname {
puppet::config::main {
'certname': value => $client_certname;
}
}

$additional_settings.each |$key,$value| {
puppet::config::main { $key: value => $value }
Expand Down
11 changes: 0 additions & 11 deletions spec/classes/puppet_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@

let :facts do
facts.deep_merge(
# rspec-puppet(-facts) doesn't mock this
clientcert: 'client.example.com',
# Cron/systemd timers are based on the IP - make it consistent
networking: { ip: '192.0.2.100' }
)
Expand Down Expand Up @@ -73,7 +71,6 @@
it { is_expected.to contain_file(confdir).with_ensure('directory') }
it { is_expected.to contain_concat("#{confdir}/puppet.conf") }
it { is_expected.to contain_concat__fragment('puppet.conf_agent').with_content(/^\[agent\]/) }
it { is_expected.to contain_puppet__config__agent('certname').with_value(facts[:clientcert]) }
it { is_expected.to contain_puppet__config__agent('report').with_value('true') }
it { is_expected.not_to contain_puppet__config__agent('prerun_command') }
it { is_expected.not_to contain_puppet__config__agent('postrun_command') }
Expand Down Expand Up @@ -351,14 +348,6 @@
it { should_not contain_file('/var/lib/puppet/state/agent_disabled.lock') }
end

context 'with client_certname => false' do
let :params do
super().merge(client_certname: false)
end

it { is_expected.not_to contain_puppet__config__agent('certname') }
end

context 'with report => false' do
let :params do
super().merge(report: false)
Expand Down
31 changes: 31 additions & 0 deletions spec/classes/puppet_config_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'spec_helper'
require 'deep_merge'

describe 'puppet' do
on_os_under_test.each do |os, facts|
Expand Down Expand Up @@ -132,6 +133,36 @@
end
end

describe 'client_certname' do
context 'with client_certname => $::clientcert' do
let :facts do
# rspec-puppet(-facts) doesn't mock this
facts.deep_merge(clientcert: 'client.example.com')
end
let :params do
super().merge(client_certname: facts[:clientcert])
end

it { is_expected.to contain_puppet__config__main('certname').with_value(facts[:clientcert]) }
end

context 'with client_certname => "foobar"' do
let :params do
super().merge(client_certname: 'foobar')
end

it { is_expected.to contain_puppet__config__main('certname').with_value('foobar') }
end

context 'with client_certname => false' do
let :params do
super().merge(client_certname: false)
end

it { is_expected.not_to contain_puppet__config__main('certname') }
end
end

context 'puppetmaster' do
describe "when puppetmaster => 'mymaster.example.com'" do
let :params do
Expand Down