On Mon, May 07, 2012 at 12:01:12PM -0700, Aleksey Tsalolikhin wrote:
> On Sat, May 5, 2012 at 4:12 PM, Victor Balada Diaz <vic...@bsdes.net> wrote:
> > 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).
> 
> Dear Victor,
> 
>   Use the "this" context to use Special Variables available to you by
> invoking the
> special context "this".
> 
>   This is documented at
> 
> http://cfengine.com/manuals/cf3-Reference#Variable-context-this
> 
> Please read that and then if you still have questions, let us know.

Hello Alskey,

Thanks a lot for your answer. Probably i wasn't clear on my first question. I've
already read that part of the documentation, but:

Note that every unqualified variable is automatically considered to be in 
context ‘this’, so that a reference to the variable $(foo) is identical to 
referencing $(this.foo)

In theory this:
                                edit_defaults => no_backup,                     
                           
                                edit_line => 
resolvconf("@($(this.cnf)[domains])",                         
                                                        
"@($(this.cnf)[dns_servers])");  

Should be the same as this:

                                edit_defaults => no_backup,                     
                           
                                edit_line => resolvconf("@($(cnf)[domains])",   
                      
                                                        
"@($(cnf)[dns_servers])");  

In my example isn't. One (the second) fails, and one (the first) works.

A previous paragraph says:

It is context dependent and not universally meaningful or available, but 
provides a context for variables where one is needed (such as when passing the 
value of a list variable into a parameterized edit_line promise from a file 
promise)

Ie: this could mean anything.

My question is: When you MUST use $(this)? 

Regards.
Victor.
-- 
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

Reply via email to