[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Executing a file only on later passes
From: |
Chip Seraphine |
Subject: |
Re: Executing a file only on later passes |
Date: |
Mon, 03 Nov 2003 15:12:57 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.2.1) Gecko/20030121 |
Mark.Burgess@iu.hio.no wrote:
OK, I now finally actually get the whole darned AddInstallable thing. I
just ran a couple quick tests, but I think this solves the problem. The
hell of it is that I've seen this explained before, but I had never
quite *got* it. Thanks.
Perhaps you could explain it in your own words. That might help
someone else. I could make your words into a FAQ. The Gospel
according to Chip, Mark Luke and John...and Steve and Alva and...
I am seriously considering legally changing my name to Matt just for the
added joke value here.
I think Eric said it very well, although he used verbage particular to
the discussion at hand. I think what really helped was that I finally
had an example smacking me upside the head... so I'll rephrase what he
said as best I can and provide such an example. What I've got below is
awfully wordy, but I think this might be a sufficiently confusing
subject to warrant the column-inches....
--
Cfengine attempts to optimize resource usage by ignoring code whose
exeuction is dependent upon currently undefined classes. This can cause
problems if the class will be defined later. In order to avoid this
situation, the parser can be cued to avoid optimizing out such code by
placing the controlling class(es) in the AddInstallable list.
If an action is controlled by an undefined class listed in the
AddInstallable list, cfengine will defer execution of the controlled
action in order to give the rest of the script an opportunity to define
the class in question. (Conversely, you may regard *not* marking a
class Installable as telling cfengine to assume the class should be
ignored unless already defined in previously parsed code. This is
probably only desirable if you are doing performance tuning.)
As an example, suppose a simple script intended to generate a message if
the system has a file named /bin/sh:
control:
## AddInstallable = ( bin_sh_exists )
actionsequence = ( files shellcommands )
shellcommands:
bin_sh_exists:: "/bin/echo Bourne shell was found"
files:
/bin/sh elsedefine=bin_sh_exists
The above example is broken, because the echo line is ignored by the
parser; it sees that the "bin_sh_exists" class is not defined and
optimizes away all code protected by that class.
Uncommenting the AddInstallable line will cause cfengine to defer the
protected code instead of ignoring it. After the files section has run,
the code in shellcommands: protected by "bin_sh_exists" will be executed.
Note that this is of particular interest when importing files with the
import: section, as the classes that control their importation must be
flagged in AddInstallable unless they are previously defined in the
parent script.
--
That sound good?
-Chip
- Re: Executing a file only on later passes, (continued)
- Re: Executing a file only on later passes, Chip Seraphine, 2003/11/03
- Re: Executing a file only on later passes, Mark . Burgess, 2003/11/03
- Re: Executing a file only on later passes, Wipf, Stefan, 2003/11/03
- Re: Executing a file only on later passes, Mark . Burgess, 2003/11/03
- Re: Executing a file only on later passes, Wipf, Stefan, 2003/11/03
- Re: Executing a file only on later passes, Chip Seraphine, 2003/11/03
- Re: Executing a file only on later passes, Eric Sorenson, 2003/11/03
- Re: Executing a file only on later passes, Mark . Burgess, 2003/11/03
- Re: Executing a file only on later passes, Chip Seraphine, 2003/11/03
- Re: Executing a file only on later passes, Mark . Burgess, 2003/11/03
- Re: Executing a file only on later passes,
Chip Seraphine <=
RE: Executing a file only on later passes, Wheeler, John, 2003/11/03