This is an awful hack, but its how I am currently defining global classes from 
a non-global scope...


bundle agent process_single_bundle(policy_name)
{
...
.......
methods:
    some_class_defined::
        "any" usebundle        =>    
define_global_class("$(policy_name)_weapons_free");
....
....


In my cfengine_stdlib, I’ve defined the below.  Using bundle common instead of 
bundle agent gives me a global scope.





bundle common define_global_class(define_this_class)
{
classes:
    "define_this_class"    expression    =>    
usemodule("module_define_global_var","$(define_this_class)");
}


And in my modules, I have this stupid script.




$ cat ..modules/module_define_global_var
#!/bin/bash

echo "+$1"




So, this gives me the end result I want... It allows me to specify any class 
name I want from any scope and allow that class to be global.... But there has 
got to be a better way of doing this.  Anyone have a working example you’d like 
to share?

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

Reply via email to