Skip to content

Commit 5619355

Browse files
committed
Support running a validation command on the destination file.
1 parent d97a047 commit 5619355

2 files changed

Lines changed: 18 additions & 9 deletions

File tree

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ Ensure there's a newline at the end of the fragments.
216216
- ensure_newline => true
217217
- ensure_newline => false
218218

219+
#####`validate_cmd`
220+
Ensure the destination file passes the following validation command.
221+
222+
######Example
223+
- validate_cmd => '/usr/sbin/apache2 -t -f %'
224+
- validate_cmd => '/usr/sbin/visudo -c -f %'
225+
219226
####concat::fragment
220227

221228
#####`target`

manifests/init.pp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
$replace = true,
6565
$order = 'alpha',
6666
$ensure_newline = false,
67+
$validate_cmd = undef,
6768
$gnu = undef
6869
) {
6970
validate_re($ensure, '^present$|^absent$')
@@ -173,15 +174,16 @@
173174
}
174175

175176
file { $name:
176-
ensure => present,
177-
owner => $owner,
178-
group => $group,
179-
mode => $mode,
180-
replace => $replace,
181-
path => $path,
182-
alias => "concat_${name}",
183-
source => "${fragdir}/${concat_name}",
184-
backup => $backup,
177+
ensure => present,
178+
owner => $owner,
179+
group => $group,
180+
mode => $mode,
181+
replace => $replace,
182+
path => $path,
183+
alias => "concat_${name}",
184+
source => "${fragdir}/${concat_name}",
185+
validate_cmd => $validate_cmd,
186+
backup => $backup,
185187
}
186188

187189
# remove extra whitespace from string interpolation to make testing easier

0 commit comments

Comments
 (0)