Class In Action Sequence

From Cfwiki

Jump to: navigation, search

The following code snippet gives an example of flow control when defining a class in the actionsequnce:

control:
 
    actionsequence = ( shellcommands links shellcommands.lastpass )
 
shellcommands:
 
    any::
        "/bin/echo anypass"
 
    lastpass::
        "/bin/echo lastpass"
 
links:
 
    any::
        /var/tmp/cfagent1.conf -> /var/tmp/cfagent.conf

In this example we define "lastpass" as class that get defined when shellcomands is executed. Here is the output:

*********************************************************************
 Main Tree Sched: shellcommands pass 1 @ Thu Oct 14 16:43:46 2004
*********************************************************************
 
 
(Non privileged user...)
 
cfengine:: Executing script /bin/echo anypass...(timeout=0,uid=-1,gid=-1)
(Setting umask to 77)
cfengine::/bin/echo anypa: anypass
cfengine:: Finished script /bin/echo anypass
 
*********************************************************************
 Main Tree Sched: links pass 1 @ Thu Oct 14 16:43:46 2004
*********************************************************************
 
 
(Non privileged user...)
 
cfengine:: Linking files /var/tmp/cfagent1.conf -> /var/tmp/cfagent.conf
 
*********************************************************************
 Main Tree Sched: shellcommands.lastpass pass 1 @ Thu Oct 14 16:43:46 2004
*********************************************************************
 
 
(Non privileged user...)
 
 
                  New temporary class additions
                  --------( Pass 1 )-------
                             lastpass
cfengine:: Executing script /bin/echo lastpass...(timeout=0,uid=-1,gid=-1)
(Setting umask to 77)
cfengine::/bin/echo lastp: lastpass
cfengine:: Finished script /bin/echo lastpass

You will notice that the defintion of the lastpass happens after the links section. And that only the shellcomands after the lastpass class get executed.

Personal tools