[Top][All Lists]

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

Puzzler: Can cfengine replace make?

From: Steve Traugott
Subject: Puzzler: Can cfengine replace make?
Date: Tue, 6 Nov 2001 00:15:41 -0800
User-agent: Mutt/1.2.5i

(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 \

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 $@

        - stopsrc -s xntpd
        ntpdate -b $(NTPDATE_SERVERS)
        startsrc -s xntpd

        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; \
        touch $@

        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:


...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

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 Traugott   ` .  *  +                       
Infrastructure Architect            + `     
address@hidden    '   *  .   '  +`   *

Attachment: pgpVsdqc8Jim9.pgp
Description: PGP signature

reply via email to

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