[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Puzzler: Can cfengine replace make?

From: Mark . Burgess
Subject: Re: Puzzler: Can cfengine replace make?
Date: Tue, 6 Nov 2001 23:12:43 +0100 (MET)

On  6 Nov, Steve Traugott wrote:
> (Cc'ing to both address@hidden and address@hidden).
> Hi All,
> A puzzler for you; your answers will feed into the cfengine workshop
> at LISA...
> Many of us commonly use 'make' as a state engine for tracking
> long-term dependencies over the life of a machine.  For instance,
> here's a fragment of a real-world makefile, used in a AIX environment,
> for building HACMP clusters:
> _______________________________________________________________________
> Block12: Block10 bos.sysmgt_client cvs- XML-XPath-1.10 xpath \
> gnu.wget- rpm.rte \
>       sudo-1.6.3p7-1.aix4.3.ppc.rpm tmp_48M_v3 hupsyslog \
> java130 rm_nim_master IS-Init-0.92 \
>       monitor serial_console xntpd 100_full_once set_sizes \
>       lynx-2.8.3.rel1-1.aix4.3.ppc.rpm
> xntpd: set_timezone ntp_config ntpdate
>       rpm -Uvh $(rpmdir)/xntp-3.4y-1.aix4.3.ppc.rpm
>       mkitab "xntpd:2:once:startsrc -s xntpd";
>       startsrc -s xntpd
>       touch $@
> ntpdate:
>       - stopsrc -s xntpd
>       ntpdate -b $(NTPDATE_SERVERS)
>       startsrc -s xntpd
> ntp_config:
>       mkdir -p /etc/ntp
>       touch /etc/ntp/keys
>       if [ -n "$(NTP_MASTER)" ]; \
>       then \
>         rm -f /etc/ntp.conf; \
>         ln -s /etc/ntp.conf.master /etc/ntp.conf; \
>       else \
>         rm -f /etc/ntp.conf; \
>         ln -s /etc/ntp.conf.broadcastclient /etc/ntp.conf; \
>       fi
>       touch $@
> set_timezone:
>       chtz $(TIMEZONE)
>       touch $@
> _______________________________________________________________________
> The full makefile is 594 lines long.  It is called by a wrapper script
> (194 lines) which essentially does this:
>       (set up the environment variables to be used within the makefile)
>       cd /var/isconf/stamps
>       touch *
>       make -f /path/to/makefile Block12
> This wrapper script is normally run as an rc script at every boot.
> Most, but not all, of the stanzas in the makefile do a "touch $@" at
> their conclusion, as you can see above.  If a particular stanza has
> already got a stampfile in /var/isconf/stamps, then 'make' will skip
> it, making sure it will only get run *once* for the life of the
> machine (/var/isconf/stamps never gets purged).  
> Now look at the flow for xntpd.  On the first boot after the machine
> is installed, these stanzas will execute, in this order:
>       set_timezone
>       ntp_config
>       ntpdate
>       xntpd
> ...of those four, they all do a 'touch' of a stampfile except ntpdate.
> That means that the timezone will be set once, the ntp config file
> symlink will be set once, ntpdate will run, and then xntpd will be
> installed once, at first boot only, for the life of the machine.  Make
> sense?
> But ntpdate will still run every time, at each subsequent boot.  Still
> make sense?
> Now, here's the question:  Can anyone see a way to do this once-only
> type of action cleanly in cfengine?  I've tried several different ways
> over the years, but I've never been satisfied with the results.  
> Steve

The question of whether cfengine can replace make is perhaps not
as important as whether it should. Similarly one can ask whether
make should or can replace cfengine.

Clearly make and cfengine are two different things, designed for
quite different purposes. As Ted showed, and Jon added, it is
possible to do all kinds of make-like things with cfengine,
provided one thinks in a "cfengine way". Trying to make cfengine
work like make is cumbersome and it's best to think in a more
cfengine kind of way.

Make can also be fudged to do cfengine-like stuff, but not
without a certain ugliness and, as Ted pointed out, without
having to implement "convergence" in every action. 

Cfengine is much more efficient at doing its specialized tasks
than make + shell -- it would be a lousy program not to be,
since shell is pretty heavy going. I think that make was designed
to traverse hierarchical dependency trees in an ordered fashion.
That is not a problem which one often needs to solve in
system admin -- where the dependencies are usually much simpler.
Cfengine is optimized to solve partially-ordered trees (see
Frode Sandnes paper at LISA!). In addition it has a bunch of
specialized tools.

Hope this adds fuel for thought,


Work: +47 22453272            Email:  address@hidden
Fax : +47 22453205            WWW  :

reply via email to

[Prev in Thread] Current Thread [Next in Thread]