Why doesn’t this work?  Classes are evaluated after variables?

The hostname of the box I’m running this on in canonical form is esv4_cfe_guppy.

$ cat test.cf
body common control
{
        bundlesequence  =>      { testit };
}
#####
bundle common global
{
vars:
        "test_boxes"    slist   =>      { "esv4_cfe_guppy", "host2", "host3" };

classes:
        "test_class"    or      =>      { @(test_boxes) };
}
######
bundle agent testit
{
reports:
        test_class::
                "I got here";
}


This fails.

$ /var/cfengine/bin/cf-agent -I -K -f ./test.cf
$


Changing from @(test_boxes) to explicitly defining the hosts works.

$ /var/cfengine/bin/cf-agent -I -K -f ./test.cf
R: I got here



Why?  Do I need to call a special function to expand the slist so the class 
gets defined like I’m trying to do?


$ cat test.cf
body common control
{
        bundlesequence  =>      { testit };
}
#####
bundle common global
{
vars:
        #"test_boxes"   slist   =>      { "esv4_cfe_guppy", "host2", "host3" };

classes:
        #"test_class"   or      =>      { $(test_boxes) };
        "test_class"    or      =>      { "esv4_cfe_guppy", "host2", "host3" };
}
######
bundle agent testit
{
reports:
        test_class::
                "I got here";
}


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

Reply via email to