Tuesday, March 20, 2012

On to Modules

Having taken a first look at the nodes, I think I'll also take a quick tour of the modules they include.

- Where are they?
$ cd puppet/modules
- How many modules are there?
$ ls | wc -l
131
A fair number.  I have no standard of comparison.  At this level, it's a flat directory structure, which makes the number pretty big, but I haven't yet seen another way to organize, group, and simplify this structure.

- Which modules have a substructure?
$ ls */manifests/*.pp | grep -v init.pp
Yikes!  All the modules have everything in their init.pp files.  This is a bit different from the examples I saw in class, which farmed out different pieces of the modules into different .pp files.  Okay, that's interesting.

- How big are the init.pp files?
$ wc -l */manifests/*.pp | sort -n
Some are pretty big.  httpd's is 537 lines long; however, almost a third of them fit in a single screen
$ wc -l */manifests/*.pp | awk '$1 < 24' | tee /tmp/short | wc -l
42
The answer to life, the universe, and the number of Fedora Infrastructure Puppet modules that will fit on a terminal screen.

- How many have subclasses?
The course I took showed us subclasses, but I'm not comfy with them yet, so it'd be good to look through some examples to understand them.
$ grep 'class.*::'  */manifests/*.pp | uniq | tee /tmp/subclassed | wc -l
112
- What short, init.pp files have subclasses?

Some modules that'll fit on a screen even have subclasses, since 112+42 > 131.  Which ones?

$ comm  -12 /tmp/short /tmp/subclassed | wc -l
34
Great!  Most of the short init.pp files have subclasses.  Files short enough that I can read them on the screen, but with enough complexity that I'll learn how folks really use subclasses.

No comments:

Post a Comment