Support running a validation command on the destination file.

This commit is contained in:
Joshua M. Keyes 2014-11-12 18:54:22 -08:00
parent d97a047e35
commit 561935586d
2 changed files with 18 additions and 9 deletions

View file

@ -216,6 +216,13 @@ Ensure there's a newline at the end of the fragments.
- ensure_newline => true
- ensure_newline => false
#####`validate_cmd`
Ensure the destination file passes the following validation command.
######Example
- validate_cmd => '/usr/sbin/apache2 -t -f %'
- validate_cmd => '/usr/sbin/visudo -c -f %'
####concat::fragment
#####`target`

View file

@ -64,6 +64,7 @@ define concat(
$replace = true,
$order = 'alpha',
$ensure_newline = false,
$validate_cmd = undef,
$gnu = undef
) {
validate_re($ensure, '^present$|^absent$')
@ -173,15 +174,16 @@ define concat(
}
file { $name:
ensure => present,
owner => $owner,
group => $group,
mode => $mode,
replace => $replace,
path => $path,
alias => "concat_${name}",
source => "${fragdir}/${concat_name}",
backup => $backup,
ensure => present,
owner => $owner,
group => $group,
mode => $mode,
replace => $replace,
path => $path,
alias => "concat_${name}",
source => "${fragdir}/${concat_name}",
validate_cmd => $validate_cmd,
backup => $backup,
}
# remove extra whitespace from string interpolation to make testing easier