Skip to content

Commit

Permalink
Fix validate_cmd file resource parameter
Browse files Browse the repository at this point in the history
The validate_cmd parameter is only valid on newer versions of puppet.
This module is supporting all 3.x versions of puppet. This commit only
applies the validate_cmd parameter to the file resource if it is
defined and adds documentation noting that it will not work on older
versons of puppet.
  • Loading branch information
Colleen Murphy committed Feb 12, 2015
1 parent 3a634af commit a198e5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ Ensure there's a newline at the end of the fragments.

#####`validate_cmd`
Ensure the destination file passes the following validation command.
Only supported on Puppet >= 3.5.0.

######Example
- validate_cmd => '/usr/sbin/apache2 -t -f %'
Expand Down
8 changes: 7 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,16 @@
path => $path,
alias => "concat_${name}",
source => "${fragdir}/${concat_name}",
validate_cmd => $validate_cmd,
backup => $backup,
}

# Only newer versions of puppet 3.x support the validate_cmd parameter
if $validate_cmd {
File[$name] {
validate_cmd => $validate_cmd,
}
}

# remove extra whitespace from string interpolation to make testing easier
$command = strip(regsubst("${script_command} -o \"${fragdir}/${concat_name}\" -d \"${fragdir}\" ${warnflag} ${forceflag} ${orderflag} ${newlineflag}", '\s+', ' ', 'G'))

Expand Down

0 comments on commit a198e5d

Please sign in to comment.