refresh exec before executing package install
I keep coming up against this issue so me thinks I must be approaching it the wrong way. It seems like such a common thing that one would want to do and yet it seems very hard with Puppet. Thus, I must be trying to do it wrong :)
Say you have a package resource and you want to make sure you do a "yum clean all" before that Package triggers an update because the package is ensure => latest.
The only way I know how to do a "yum clean all" is via an exec. But, I don't want the exec to fire on every puppet run so of course I want to set it to either "refresh only" or set an "only if" condition.
As far as I can tell there is no way to send a refresh to the exec BEFORE puppet tries to update the package and I have no idea what "only if" condition I could set that would correspond with the package being updated such that the exec "yum clean all" would always happen just before the package update...
Can someone give me a hint please?