help-cfengine
[Top][All Lists]
Advanced

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

Re: Questions about importing and variables


From: christian pearce
Subject: Re: Questions about importing and variables
Date: Thu, 29 Sep 2005 13:01:23 -0400

This still seems to apply for groups.  Can we update the documentation?

pearcec@dhcp-5010-230:~/.cfagent/inputs$ tail -100 cf.import cf.class
==> cf.import <==
control:

    actionsequence = ( shellcommands )

    variable2 = ( "value2" )

import:

    cf.class

shellcommands:

    any::
        "/bin/echo cf.import ${variable}"

    class_true::
        "/bin/echo cf.import ${variable2}"



==> cf.class <==
groups:

   class_true = ( any )

pearcec@dhcp-5010-230:~/.cfagent/inputs$
CFINPUTS=/home/pearcec/.cfagent/inputs/ cfagent  -f cf.import  -KI
cfengine:: Executing script /bin/echo cf.import
${variable}...(timeout=0,uid=-1,gid=-1)
cfengine::/bin/echo cf.im: cf.import
cfengine:: Finished script /bin/echo cf.import ${variable}


On 9/29/05, christian pearce <pearcec@perfectorder.com> wrote:
> 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:
>
> pearcec@dhcp-5010-230:~/.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}"
> pearcec@dhcp-5010-230:~/.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.
>


--
Christian Pearce
Perfect Order, Inc.

reply via email to

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