How about allowing inline body definitions so instead of this (adapted
from the OP):

bundle agent test{
   files:
      "/root/.ssh/authorized_keys"
         create => "true",
         perms => m("600");
}

body perms m(mode){
   mode => "$(mode)";
}

just write this:

bundle agent test{
   files:
      "/root/.ssh/authorized_keys"
         create => "true",
         perms => {
            mode=> "600";
         };
}

I tried, but get a syntax error on mode=>"600". Writing inline bodies
is natural for a programmer (yes I know, cfengine is not a programming
language...). I think the second version is easier to read and
understand compared to the original, particularly if the perms body in
the first variant is hidden in a library. I see the need for
developing complex bodies and stuff them into libraries (which also is
natural for a programmer), but why not allow inline body definitions
as well?

- Erlend

PS: And I have not searched the archives for this, so if it has been
voiced before, I apologise.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to