On 01/02/2014 03:18 AM, james.eckers...@fasthosts.com wrote:
> How about chaining the resources, ala 
> http://docs.puppetlabs.com/puppet/2.7/reference/lang_relationships.html#chaining-arrows
> .
> 
> Yumrepo <| |> -> Package<| |>
> 
> This declared in site.pp should apply globally to all nodes and would avoid 
> the use of run stages (if I understand it correctly).
> 
> J
> 

One caveat to this is that if you are defining any packages (or the
YumRepos) virtually and then adding them to modules with 'realize', the
resource collector will realize all of the virtual packages, regardless
whether if you're realizing them in a module or not.  This behavior is
documented in the resource chaining documentation.

I ran into this personally with a couple of custom modules that we use
virtual packages with so that we don't get duplicate resource errors
when managing various packages.  My case was very similar, I had a
custom Yum repo I wanted to ensure that was put in place before puppet
tried to install a package out of it, so I had defined the chaining
within the module for the yum repo of:

Yumrepo['CustomRepo'] -> Package <| name == 'CustomPackage' |>

However, when I moved the custom package into our virtual package
resources, that package started getting realized on machines that didn't
need it, but I had forgotten that I had done the above resource
chaining.  Fortunately, we did provide a way to require repos with our
virtual package definitions, so I was able to remove the resource
chaining and still have the desired result.

-- 
Joseph Swick <joseph.sw...@meltwater.com>
Operations Engineer
Meltwater Group

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to