Skip to content

Commit

Permalink
Support running a validation command on the destination file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmkeyes committed Nov 13, 2014
1 parent d97a047 commit 5619355
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
20 changes: 11 additions & 9 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
$replace = true,
$order = 'alpha',
$ensure_newline = false,
$validate_cmd = undef,
$gnu = undef
) {
validate_re($ensure, '^present$|^absent$')
Expand Down Expand Up @@ -173,15 +174,16 @@
}

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
Expand Down

0 comments on commit 5619355

Please sign in to comment.