FAQ
Does your repos class have a bunch of classes included? If so, those are
not caught by the require and you need to use the anchor pattern:

http://projects.puppetlabs.com/projects/puppet/wiki/Anchor_Pattern

The ordering (no matter how you do it) only orders the *resources* in that
class. Not the resources in classes that are *included* in your repos class.
On Wednesday, June 19, 2013 6:00:03 PM UTC-6, Stack Kororā wrote:

Greetings!

tl;dr Why doesn't require=>Class work?

I have a module I built that I creatively called "repos". This does a
number of things for me:
* I have many systems on different networks. Depending on the network
depends on which repository the servers get their packages from.
* I have many OS's (RHEL, Scientific, CentOS, SuSE) and several different
releases of those OS's (ex: RHEL6 vs RHEL5).
* Some systems get repositories that others don't (ex: VMware guests get
the ESXi guest tools repo).
* We roll our own packages for some software; only systems of a certain
type get these repos.
* ect.

This class does a wonderful job for me. I barely have to do anything in
the node definition other than "class { 'repos': } " and it just figures
out which systems get what repo's based on facter and various parameters
(like current network IP).

Here is the problem though.
package {["htop":ensure=>installed, }

Chances are *really* good that on first runs when the repo hasn't yet been
created, what will happen is:
* Error: can't find htop.
* Installing EPEL
*Done!

Well that isn't what I want, obviously. Thus I tried:
package {["htop":ensure=>installed,require=>Class['repos'],}

Still the same result as before. It never fully configures the repo before
trying to install. Then I tried:
package {["htop":ensure=>installed,require=>Yumrepo['EPEL'],}

It works!! Hooray! And then I hit a failure point. This next statement
works for Scientific Linux but fails for CentOS6 because a CentOS system
won't have the SL6 repo!
package {["tuned":ensure=>installed,require=>Yumrepo['SL6'],}

I have come up with two "solutions".
1) Change all the repos to use generic names like "Base" and "Security".
While it is a big bandaid, it doesn't really fix the problem as there is
still potential for packages to conflict.

2) Find out why "require=>Class['repos']" doesn't work and fix it. This
would solve all my problems if the repos were run and configured properly
before packages were installed. The only "problem" would then be to make
sure I am not trying to install a package that legitimately doesn't exist
in the repos (like tuned on a CentOS 5 box) but that would fall squarely
into a PEBKAC and there is only so much I can script to catch those. :-)

Can anyone help me with this please? Any ideas on how I can fix this?

Thanks!
--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 7 | next ›
Discussion Overview
grouppuppet-users @
categoriespuppet
postedJun 20, '13 at 12:00a
activeJul 1, '13 at 2:32p
posts7
users4
websitepuppetlabs.com

People

Translate

site design / logo © 2023 Grokbase