diff --git a/README.md b/README.md index d3e286051..8225b05e6 100644 --- a/README.md +++ b/README.md @@ -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 %' diff --git a/manifests/init.pp b/manifests/init.pp index 9ac3fe550..1727bec2c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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'))