You haven't missed anything. Virtual resources *are* the best practice
for avoiding duplicate definitions, such as it is. However, you won't
see them used a lot for package resource declarations; well-written
Puppet modules tend to encapsulate a discrete function, so package
conflicts tend to be rare (at least, within an organisation's own code).
Personally, I believe strongly in keeping puppet code as simple as
possible and only adding complexity (e.g. virtual definitions) where a
specific situation requires it. Adding layers of abstraction to code in
Puppet's declarative DSL causes more pain than it solves.
You have a choice of altering the third party code or your own. You
will keep encountering this problem if you use third party modules. I
guess you could do create your own safe package wrapper, something like
this:
define safepackage ( $ensure = present ) {
if !defined(Package[$title]) {
package { $title: ensure => $ensure }
}
}
And either use it everywhere (not necessarily a good idea) or wherever
you hit a problem with third party code.
Your problem is relevant to the earlier post about code reuse. I
considered responding to that (too busy, sorry) and this was one of the
kinds of scenarios that I had in mind.
--
Bruce
I must admit that the existence of Disneyland (which I know is real)
proves that we are not living in Judea in AD 50. -- Philip K. Dick
^This. I only offered the wrapper since a solution was requested.
--
Bruce
What would Edward Woodward do?
employ. I think it's better, though, to just let the compilation
failures happen -- use them to detect where you need to patch up
conflicts between modules.