help-cfengine
[Top][All Lists]
Advanced

[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-1.11.0.0.bff XML-XPath-1.10 xpath \
        bos.net.nis gnu.wget-1.6.0.0.bff rpm.rte \
        sudo-1.6.3p7-1.aix4.3.ppc.rpm tmp_48M_v3 hupsyslog \
        devices.scsi.tm 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
-- 
                        .       .    `   *    
Steve Traugott   ` .  *  +                       
Infrastructure Architect            + `     
address@hidden    '   *  .   '  +`   *   
http://www.stevegt.com/

Attachment: pgpVsdqc8Jim9.pgp
Description: PGP signature


reply via email to

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