Re: Various FreeBSD bits...

Sean Chittenden
Tue, 13 Nov 2007 17:22:37 -0000

>> http://reductivelabs.com/trac/puppet/wiki/PuppetFreeBSD
>
> Great to see work on other friends in the circus!

Likewise!

I''m developing a notion to write and post a base set of system admin
and ports classes/macros for FreeBSD, kinda like I did for portaudit.
The problem is that some of the stock infrastructure required to make
a "standard set of classes" for an OS isn''t quite there in
the base
system so distribution of such classes requires blurbs like, "you need
this schedule, and these variables".  Just like the ports system is
just a series of Makefiles, make(1) in and of itself doesn''t create a
ports system - it needs /usr/ports/Mk/*...  The equivalent of /usr/
ports/Mk/* is lacking for puppet right now.

eg:  right now I use:

class freebsd {
   $_cflags = $cflags ? { '''' => '''',
default => $cflags }
   $_cxxflags = $cxxflags ? { '''' => '''',
default => $cxxflags }

   $_supfile = $supfile ? { '''' =>
''/etc/supfile'', default => $supfile }
   $_kernconf = $kernconf ? { '''' =>
''GENERIC'', default => $kernconf }

   $_portsdir = $portsdir ? { '''' =>
''/usr/ports'', default => $portsdir }
   $_srcdir = $srcdir ? { '''' => /usr/src'', default
=> $srcdir }
   $_objdir = $objdir ? { '''' => /usr/obj'', default
=> $objdir }
   ...
}

node ''myhost.local'' {
   $kernconf = ''blah''
   $supfile = "/nfs/supfile/$fqdn"

   include freebsd
   include freebsd::base::portsnap
   include freebsd::ports::portaudit
   ...
   include site::etc_crontab
   ...
}

The problem is that freebsd::* is dependent on my conventions and now
unique to my location with any foo that I create being mostly unusable
in the lack of a standard (in truth and more correctly, I can''t
leverage work done by others because all of the work is so fragmented
and unique).  Fortunately it''s not a lot of work and most of the heavy
lifting has been done, but...  seems like there''s a ton of effort
going into having every site recreate the wheel to wrap XYZ.

> I would really like to completely replace the perl in
> SimpleTextRecipes with
> your sed version. The problem here though is, that using \Q and \E I
> can
> reuse $line for the pattern without having to do any (further)
> escaping.
> Flipping through (GNU''s) sed(1) and texinfo I didn''t find
an
> equivalent here.
> So some kind of (automated?) quoting would have to be added. The
> optimal
> solution would be to finally re-write this in ruby, there being able
> to
> easily reuse $line as regex and string without problems.

Or a variable extension, ala sh(1)/make(1):  ${line:escape:sed}

That''s probably the easiest and safest way to ensure consistent
quoting without having to pass around various ruby functions to quote
output.

> Also I removed a spurious duplicate single quote, added ^$ anchors
> and used
> grep -q as i did in on SimpleTextRecipes and in my repo.

Thanks!

-sc

--
Sean Chittenden
sean@chittenden.org