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 => true
- ensure_newline => false - 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 ####concat::fragment
#####`target` #####`target`

View file

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