Do puppet conditionals ensure order, or do I still need to add metaparameters -
i have code similar following:
class someclass($ensure = installed) { if($ensure == installed) { $installvalue = installed file { "someprogram.msi": ensure => file, source => 'somewhere', path => 'c:/puppet-files/someprogram.msi', } } else { $installvalue = absent } package{ "someprogram": ensure => $installvalue, source => 'c:/puppet-files/someprogram.msi', } }
does if statement containing file resource ensure file resource applied before package resource? or need explicitly state in metaparameters? also, assuming $installvalue set before package installed, correct?
thank you,
derongan
you should specify ordering explicitly, variable initialised correctly.
the ordering of resources in puppet 3 deterministic, random it's based on hashes of resource titles. in puppet 3.3, behaviour can changed manifest order (release notes), wouldn't recommend relying on - if you're sharing module, there's no guarantee others use same setting.
since file resource may not exist (if ensure => absent), can't specify relationship on package resource. instead, add before => package['someprogram'],
file resource.
Comments
Post a Comment