On Mon, Sep 12, 2011 at 3:58 PM, Jerome Yanga <jya...@esri.com> wrote:
> I saw another post on how to do this but it does not seem to work for me.  
> Please correct my syntax

How's this?

[cfengine00  ~]# cat /tmp/test.txt
DOG
[cfengine00  ~]# cat test.cf
body common control {
        bundlesequence => { "animal" };
}

bundle common g
{
       vars:

               "temp"  string  =>      readfile("/tmp/test.txt", "4" );
}

bundle agent animal
{
       commands: "/bin/echo $(g.temp)";
       commands:
                       "/bin/echo I have a pet dog."
                                ifvarclass => "$(g.temp)";
}
[cfengine00  ~]# cf-agent -f ./test.cf
Q: ".../bin/echo DOG": DOG
I: Last 1 quoted lines were generated by promiser "/bin/echo DOG"
[cfengine00  ~]#

Note the use of ifvarclass attribute to use a variable as a class; and
the full name of the variable (including the bundle name) in g.temp.
CFEngine bundles have scope, so you have to use the full name to call
a variable from another bundle (even a global variable).

Yours,
-at
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to