On Thu, May 19, 2011 at 08:43:52AM -0400, no-re...@cfengine.com wrote:
>Forum: Cfengine Help
>Subject: Re: this.promiser not interpolating in copy_from?
>Author: neilhwatson
>Link to topic: https://cfengine.com/forum/read.php?3,22059,22064#msg-22064
>
>Sjoerd Oostdijck Wrote:
>> Example:
>>
>> body common control {
>>     bundlesequence => { "wiggle" };
>>     inputs => {"policies/cfengine_stdlib.cf"};
>> }
>>
>> bundle agent wiggle {
>>     files:
>>         "/tmp/snarf.txt"
>>             classes =>
>> if_repaired("snarf_copied"),
>>             perms => mog("0700","root","root"),
>>             copy_from =>
>> local_cp("$(this.promiser).template");
>
>The local_cp body is expecting the master source for /tmp/snarf.txt.  That is 
>what nees to go there.  Don't bother using this.promiser in this instance.  
>I've only seen it needed when performing group changes like -exec in find.

But there are cases where it is useful.  For example, a minor change to
the copy action above will also fail:

bundle agent wiggle {                                                           
                                                
     files:                                                                     
                                                 
         "/tmp/snarf.txt"                                                       
                                                 
             classes => if_repaired("snarf_copied"),
             perms => mog("0700","root","root"),                                
                                                 
             copy_from => local_cp("/nfs/cf_repo/$(this.promiser).template");
}


I've wanted to use ${this.promiser} in a copy_form body, as I have lots
of instances where I'm copying a list of files from a repository to a
final location and there are "no filename changes."  Then I could do
something like this (which doesn't work):

body copy_from update_this {
   any::
      servers     => { "$(g.policy_server)" };
      source      => "${g.data_files}/${this.promiser}";
      copy_backup => "timestamp";
}

bundle agent updater {                                                          
                                                 
     files:                                                                     
                                                 
         "/tmp/snarf.txt"                                                       
                                                 
             classes => if_repaired("snarf_copied"),
             perms => mog("0700","root","root"),                                
                                                 
             copy_from => update_this;
}


As it stands, the places where ${this} is valid seem to be inconsistant.
It's been a while since I looked into it, so I'll try and spend some
cycles staring at it today.

-- 
Jesse Becker
NHGRI Linux support (Digicon Contractor)
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to