Lack of idempotency with ensure => 'absent'

Need to add an unless to the exec in the case we have `ensure =>
'absent'` for the concat, otherwise the exec (of true) runs every time.
This commit is contained in:
Morgan Haskel 2014-09-08 14:24:29 -04:00
parent 15e4bc7ba6
commit e015a1fdf7
2 changed files with 4 additions and 1 deletions

View file

@ -223,10 +223,12 @@ define concat(
default => '/bin:/usr/bin',
}
# Need to have an unless here for idempotency.
exec { "concat_${name}":
alias => "concat_${fragdir}",
command => $absent_exec_command,
path => $absent_exec_path
unless => $absent_exec_command,
path => $absent_exec_path,
}
}
}

View file

@ -144,6 +144,7 @@ describe 'concat', :type => :define do
should contain_exec("concat_#{title}").with({
:alias => "concat_#{fragdir}",
:command => 'true',
:unless => 'true',
:path => '/bin:/usr/bin',
})
end