help-cfengine
[Top][All Lists]
Advanced

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

RE: reset actionsequence after import.


From: Wheeler, John
Subject: RE: reset actionsequence after import.
Date: Wed, 27 Aug 2003 10:40:50 -0500

Someone else pointed this out to me, it wasn't clear how usefull this
was. Try appending a class to the action:

#more casinoDeploy.conf
control:
        actionsequence  = (
                        shellcommands.casinoDeploy
                        )
        TAG     = ( deploy_casino_20030819 )
        CVSTAGFILES     = ( "sysops/applications/casino/cvstagfiles" )
        SOURCEDIR       = ( /export/home/deploy )
        ANTHOME         = ( /usr/local/ant )
        payment_qa::
                hostname = ( casino )
                IP_suf = ( 49 )
                IP_pre = ( 10.7.1 )
                IP     = ( "${IP_pre}.${IP_suf}" )
                paymenthost = ( "epayhipvar.paymentech.net" )
                routeline = ( "route add -host ${paymenthost} ${IP}
-interface" )

shellcommands:
        casinoDeploy::
                '/bin/su - deploy -c "cvs checkout -r $(TAG)
${CVSTAGFILES}"'
                '/bin/su - deploy -c "${CVSTAGFILES} $(TAG)"'

import:
        casinoAppSite.conf
        casinoAppDeploy.conf




# more casinoAppSite.conf
import:
        ifconfig.conf
        paymentuser.conf

# more ifconfig.conf
control:
        actionsequence  = (
                        editfiles.ifconfig
                        shellcommands.ifconfig
                        )
        Split = ( ; )
        ifstring        = ( "netmask + broadcast + up" )
        interface_name  = ( "hme0:$(IP_suf)" )
        hoststring      = ( "$(IP)$(tab)$(hostname)" )

editfiles:
        ifconfig::
                { /etc/hosts
                        Inform "on"
                        BeginGroupIfNoSuchLine "${hoststring}"
                        Append "${hoststring}"
                        EndGroup
                }
                { /etc/hostname.$(interface_name)
                        AutoCreate
                        BeginGroupIfNoSuchLine "$(hostname)"
                        Append "$(hostname)"
                        EndGroup
                }

shellcommands:
        ifconfig::
                '/sbin/ifconfig $(interface_name) >/dev/null 2>&1'
                        define=ifexists
        !ifexists.ifconfig::
                '/sbin/ifconfig $(interface_name) plumb'
                '/sbin/ifconfig $(interface_name) $(IP) $(ifstring)'

# more paymentuser.conf
control:

        actionsequence  = (
                        directories.paymentuser
                        copy.paymentuser
                        editfiles.paymentuser
                        )

directories:

        paymentuser::
                /export/home/payment
                        mode=755
                        inform=on
                        owner=102333
                        group=20000
                        inform=true
                /export/home/payment/.ssh
                        mode=700
                        inform=on
                        owner=102333
                        group=20000
                        inform=true

copy:

        paymentuser::
                /cfengine/users/payment
                        dest=/export/home/payment
                        recurse=inf
                        owner=102333
                        group=20000
                        exclude=id_rsa
                        mode=700
                        inform=true
                        server=$(masterhost)

editfiles:
        paymentuser::
                { /export/home/payment/.profile
                        ReplaceAll "@ANTHOME@" With "${ANTHOME}"
                }





ok, you get the idea, basically I try to write "functions" in cfengine
and control the functions with macros/variables. My final action
sequence is something like

shellcommands.casinoDeploy
directories.paymentuser
copy.paymentuser
editfiles.paymentuser
editfiles.ifconfig
shellcommands.ifconfig
....

What's important is that I can perform one shellcommand to do one thing,
then later perform another shellcommand to do something else.

I think that the notion of "passes" (pass 1 vs pass 2) may also be used
in a similar way.



-----Original Message-----
From: Hans Deragon [mailto:hans@deragon.biz] 
Sent: Wednesday, August 27, 2003 10:11 AM
To: help-cfengine@gnu.org
Subject: reset actionsequence after import.

This is a repost, since it did not show up in the mailing list the first
time... 
  My first post was on aug 26, 10:21.

--------------

Greetings.


    I am trying to build a very modular hiearchy of cf.* files using the
import:
command.  However, I have stumbled on a little problem.

    I define and actionsequence within each of my imported files.
However, the
actionsequences add up instead of being reseted per file.  For instance,
if
file cf.A imports file cf.B and the following is to be found in the
files:

File cf.A:

   control:

    actionsequence =
    (
      editfiles
    )

   import:

     cf.B

File cf.B

    control:

    actionsequence =
    (
      copy
      editfiles
      shellcommands
    )

The final action sequence when executing would be { editfiles, copy,
editfiles,
shellcommands }, thus running the editfiles command prior the copy
command when
cf.B is run (which is a problem because I need the file to be copied
before it
is being edited).

Is there a way to instruct cfengine to only execute the actionsequence
of cf.B
when running the commands found in cf.B?  I want cf.B to inherit its
configuration from cf.A, but I do not want it to inherit the action
sequence.

I am going to have a dozen of cf.* files.  I thought that I could all
have the
executed in one cfagent call.  But if their actionsequence command get
mangled,
then I guess I will have to call cfagent 12 times.  Is this what I am
supposed
to do?


Best regards,
Hans Deragon
--
Consultant en informatique/Software Consultant
Deragon Informatique inc.         Open source:
http://www.deragon.biz            http://swtmvcwrapper.sourceforge.net
mailto://hans@deragon.biz         http://autopoweroff.sourceforge.net




_______________________________________________
Help-cfengine mailing list
Help-cfengine@gnu.org
http://mail.gnu.org/mailman/listinfo/help-cfengine




reply via email to

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