Hello, I'm trying to write a policy (attached at the end) to play with resolv.conf. For it to work i need to use $(this) context and i can't understand why and when should i use $(this). Doc is not clear and doesn't seem to even talk about this case. I've found this "trick" on examples/unit_resolveconf.cf.
Could someone please explain why and when it's needed? Am i missing something obvious? Example policy works as expected: body common control { inputs => { "cfengine_stdlib.cf"}; bundlesequence => {"main"}; } bundle agent main { vars: "resolv[domains]" slist => { "example.net" }; "resolv[dns_servers]" slist => { "10.0.0.1", "10.0.0.2" }; methods: "foo" usebundle => resolv_conf("main.resolv"); } bundle agent resolv_conf(cnf){ files: "/tmp/resolv.conf" edit_defaults => no_backup, edit_line => resolvconf("@($(this.cnf)[domains])", "@($(this.cnf)[dns_servers])"); } If i remove $this from the the last line to look like this: edit_line => resolvconf("@($(cnf)[domains])", "@($(cnf)[dns_servers])"); Fails to compile with: !! List parameter "$(cnf)[domains]" not found while constructing scope "resolvconf" - use @(scope.variable) in calling reference !! List parameter "$(cnf)[dns_servers]" not found while constructing scope "resolvconf" - use @(scope.variable) in calling reference Thanks a lot. Regards. -- La prueba más fehaciente de que existe vida inteligente en otros planetas, es que no han intentado contactar con nosotros. _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine