Josh Smith wrote: > PK == Paul Krizak <[EMAIL PROTECTED]> > > PK> As far as I know, cfengine does imports *last*. That means that despite > PK> your import statement being at the top of your file, cfgroups.conf isn't > PK> actually imported until after the containing file is parsed. > PK> > PK> Luckily, imports *are* imported serially, so you can get around this > PK> restriction by adding yet another wrapper. For example: > PK> > PK> update.conf: > PK> > PK> import: > PK> any:: > PK> cfgroups.conf > PK> real_update.conf > > This feels clunky, but it seems to work. Thanks for the tip!
When using import, many people end up being confused about the ordering of their code. This is because cfagent first reads an entire file and then performs any necessary imports. In other words, imports are not processed when they are reached. This means that any variables that are defined in an imported file are not available further on in the importing file. This can be quite confusing to people who are used to other programming languages. Therefore, I suggest bypassing the issue entirely: a cfengine input file should either be entirely imports or contain no imports at all. This gets rid of any ambiguity and promotes code modularity. >From http://praksys.blogspot.com/2005/12/cfengine-best-practices.html Best, Brendan -- Senior System Administrator The University of Chicago Department of Computer Science http://www.cs.uchicago.edu/people/brendan http://praksys.blogspot.com/ _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org http://cfengine.org/mailman/listinfo/help-cfengine