help-cfengine
[Top][All Lists]
Advanced

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

Questions about importing and variables


From: christian pearce
Subject: Questions about importing and variables
Date: Thu, 29 Sep 2005 11:33:57 -0400

From the reference guide:

"Note that, if you define variables in an imported file they will not
be defined for operations in their parent files. This because cfengine
reads in all the import files after the main file has been parsed—not
at the place where you call import in your script. This means that
variables or macros defined in imported files are only defined after
the main program. Variables from earlier files are inherited by later
includes, but not vice-versa."

The experiment:

address@hidden:~/.cfagent/inputs$ tail cf.import cf.value ==>
cf.import <==

shellcommands:

    "/bin/echo cf.import ${variable}"
    "/bin/echo cf.import ${variable2}"

import:

    cf.value


==> cf.value <==
control:

    variable = ( "value" )

shellcommands:

    "/bin/echo cf.value ${variable}"
address@hidden:~/.cfagent/inputs$ CFINPUTS=~/.cfagent/inputs/
cfagent -f ./cf.import -K
cfengine::/bin/echo cf.im: cf.import value
cfengine::/bin/echo cf.im: cf.import value value2
cfengine::/bin/echo cf.va: cf.value value


It appears that the macro are now expanded during the execution of an
action?  If so does any part of the documentation I quoted above
apply?  What am I am missing?
--
Christian Pearce
Perfect Order, Inc.

reply via email to

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