Forum: CFEngine Help
Subject: Re: Dynamic inbuts based on classes set from usemodule.
Author: vladi
Link to topic: https://cfengine.com/forum/read.php?3,26668,26698#msg-26698

Also tried this with no success:

bundle agent idalv {
    classes:
        "idalv_set" expression => usemodule("idalv-cftxt","");
    vars:
        idalv_set::
            "idalv_bundles" slist => { @(idalv_cftxt.txt_bundles) };
    methods:
        idalv_set::
            "use-$(idalv_bundles)" usebundle => "$(idalv_bundles)";
}

bundle common dynamic {
    classes:
        "inputs_set" expression => usemodule("idalv-cftxt","");
    vars:
        inputs_set::
        "inputs"  slist => { "update.cf", "library.cf", "classes.cf", 
"cf-execd.cf", "cf-serverd.cf", "cf-report.cf", "cleanup.cf", "reports.cf", 
"an_os.cf", "an_auth.cf" }, policy => "free";
        inputs_set&os_deb::
           "inputs"  slist => { @{inputs}, "blah2.cf" }, policy => "free";
}
    

# global vars
bundle common g {
    vars:
        "workdir"           string => "/var/cfengine";
        "masterfiles"       string => "$(workdir)/masterfiles";
        "inputs"            string => "$(workdir)/inputs";
        "modules"           string => "$(workdir)/modules";
        "configs"           string => "$(workdir)/cfg";
        "policy_host"       string => "cfengine";
        "bundles"           slist  => { "idalv" };
        "inputfiles"        slist => { "update.cf", "library.cf", "classes.cf", 
"cf-execd.cf", "cf-serverd.cf", "cf-report.cf", "cleanup.cf", "reports.cf", 
"an_os.cf", "an_auth.cf" }, policy => "free";
#       os_deb::
#       "inputfiles" slist => { @{inputfiles}, "blah2.cf" }, policy => "free";
}
body runagent control {
    hosts => { "127.0.0.1", "10.0.0.0/8" };
}
body common control {
        bundlesequence => { @(g.bundles) };
#       inputs => { "update.cf", "library.cf", "classes.cf", "cf-execd.cf", 
"cf-serverd.cf", "cf-report.cf", "cleanup.cf", "reports.cf", "an_os.cf", 
"an_auth.cf" };
        inputs => { @(dynamic.inputs) };
          output_prefix => "cf3";
}

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

Reply via email to