Forum: CFEngine Help
Subject: Re: downsizing a huge policy file, sensibly
Author: bbomgardner
Link to topic: https://cfengine.com/forum/read.php?3,24050,24187#msg-24187

David, Marco this is a very helpful strategy.

In my implementation I had been including a control class before calling the 
worker bundle, but on a closer look I don't think this is necessary.


vars:

  ......

classes:

  "users_defined" expression     =>    regarray("users",".*");
  "groups_defined" expression    =>    regarray("groups",".*");

methods:

  groups_defined::
    "any" usebundle      =>     create_groups("system_accounts.groups");

  users_defined::
    "any" usebundle      =>     create_users("system_accounts.users");


It seems that cfengine quietly ignores any attempts to reference a non-existent 
array:


body common control {
bundlesequence => { test };
}

bundle agent test {
methods:
  any::
    "any" usebundle => test1("test.array");
}

bundle agent test1(v) {
vars:

  "index" slist =>  getindices("$(v)");
  "testvar" string => "$(v)[0]";

reports:

  linux::
   "index: $(index), testvar: $(testvar)";
   "v: $(v)";
}


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

Reply via email to