Skip to content

Commit 3b80f04

Browse files
author
Pete Brown
committed
Fix #142
there appears to be a bug in puppet 4.9.4 and 4.10.0 It's use of the server setting is inconsistent. If the server is set in main the agent and manual runs use the same server value But if it's set in the agent section the agent ignores it
1 parent a15b775 commit 3b80f04

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

manifests/config.pp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,19 @@
6666
$_ensure_pluginfactsource = 'absent'
6767
}
6868

69+
ini_setting { 'puppet client server agent':
70+
ensure => absent,
71+
path => "${confdir}/puppet.conf",
72+
section => 'agent',
73+
setting => 'server',
74+
value => $puppet_server,
75+
require => Class['puppet::install'],
76+
}
77+
6978
ini_setting { 'puppet client server':
7079
ensure => $_ensure_puppet_server,
7180
path => "${confdir}/puppet.conf",
72-
section => 'agent',
81+
section => 'main',
7382
setting => 'server',
7483
value => $puppet_server,
7584
require => Class['puppet::install'],

spec/classes/puppet_config_spec.rb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,22 @@
4444
end
4545
context 'when fed no parameters' do
4646
it "should properly set the puppet server setting in #{confdir}/puppet.conf" do
47+
should contain_ini_setting('puppet client server agent').with({
48+
'ensure'=>'absent',
49+
'path'=>"#{confdir}/puppet.conf",
50+
'section'=>'agent',
51+
'setting'=>'server',
52+
'value'=>'puppet'
53+
})
4754
should contain_ini_setting('puppet client server').with({
4855
'ensure'=>'present',
4956
'path'=>"#{confdir}/puppet.conf",
50-
'section'=>'agent',
57+
'section'=>'main',
5158
'setting'=>'server',
5259
'value'=>'puppet'
5360
})
61+
end
62+
it "should properly set the puppet srv records settings in #{confdir}/puppet.conf" do
5463
should contain_ini_setting('puppet use_srv_records').with({
5564
'ensure'=>'absent',
5665
'path'=>"#{confdir}/puppet.conf",
@@ -187,12 +196,18 @@
187196
context 'when ::puppet::puppet_server has a non-standard value' do
188197
let(:pre_condition){"class{'::puppet': puppet_server => 'BOGON'}"}
189198
it "should properly set the server setting in #{confdir}/puppet.conf" do
190-
should contain_ini_setting('puppet client server').with({
199+
should_not contain_ini_setting('puppet client server').with({
191200
'path'=>"#{confdir}/puppet.conf",
192201
'section'=>'agent',
193202
'setting'=>'server',
194203
'value'=>'BOGON'
195204
})
205+
should contain_ini_setting('puppet client server').with({
206+
'path'=>"#{confdir}/puppet.conf",
207+
'section'=>'main',
208+
'setting'=>'server',
209+
'value'=>'BOGON'
210+
})
196211
end
197212
end# custom server
198213
context 'when ::puppet::environment has a non-standard value' do
@@ -283,7 +298,7 @@
283298
should contain_ini_setting('puppet client server').with({
284299
'ensure' => 'absent',
285300
'path'=>"#{confdir}/puppet.conf",
286-
'section'=>'agent',
301+
'section'=>'main',
287302
'setting'=>'server',
288303
})
289304
end

0 commit comments

Comments
 (0)