Skip to content

Commit

Permalink
Ensure config file ends with a new line
Browse files Browse the repository at this point in the history
  • Loading branch information
baurmatt committed Oct 24, 2019
1 parent 10f437e commit e87d8f2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,17 @@
-> case $::osfamily {
'Windows': {
concat { "${puppet_dir}/puppet.conf":
mode => '0674',
mode => '0674',
ensure_newline => true,
}
}

default: {
concat { "${puppet_dir}/puppet.conf":
owner => 'root',
group => $::puppet::params::root_group,
mode => '0644',
owner => 'root',
group => $::puppet::params::root_group,
mode => '0644',
ensure_newline => true,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions manifests/config/entry.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# they make sure that '1_main ' is ordered before '1_main_*'
ensure_resource('concat::fragment', "puppet.conf_${section}", {
target => "${::puppet::dir}/puppet.conf",
content => "\n\n[${section}]",
content => "\n[${section}]",
order => "${sectionorder}_${section} ",
})

Expand All @@ -39,7 +39,7 @@
if (!defined(Concat::Fragment["puppet.conf_${section}_${key}"])){
concat::fragment{"puppet.conf_${section}_${key}":
target => "${::puppet::dir}/puppet.conf",
content => "\n ${key} = ${_value}",
content => " ${key} = ${_value}",
order => "${sectionorder}_${section}_${key} ",
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions spec/defines/puppet_config_entry_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
}
end
it 'should contain the section header' do
should contain_concat__fragment('puppet.conf_main').with_content("\n\n[main]")
should contain_concat__fragment('puppet.conf_main').with_content("\n[main]")
should contain_concat__fragment('puppet.conf_main').with_order("1_main ")
end
it 'should contain the keyvalue pair' do
Expand All @@ -41,7 +41,7 @@
}
end
it 'should contain the section header' do
should contain_concat__fragment('puppet.conf_main').with_content("\n\n[main]")
should contain_concat__fragment('puppet.conf_main').with_content("\n[main]")
should contain_concat__fragment('puppet.conf_main').with_order("1_main ")
end
it 'should contain the keyvalue pair' do
Expand All @@ -63,7 +63,7 @@
}
end
it 'should contain the section header' do
should contain_concat__fragment('puppet.conf_main').with_content("\n\n[main]")
should contain_concat__fragment('puppet.conf_main').with_content("\n[main]")
should contain_concat__fragment('puppet.conf_main').with_order("1_main ")
end
it 'should contain the keyvalue pair' do
Expand Down

0 comments on commit e87d8f2

Please sign in to comment.