Yeap you are right I was too fancy.  Neil did suggest to go about it with two 
promises... But why listen when you are set in your way!!!!

My mistake... I am down the two promises path right now and guess what it 
works!!!! Go figure oh well not all is lost I have learnt in the process.

So to all thanks,

Marco

-----Original Message-----
From: Mark Burgess [mailto:cont...@cfengine.com] 
Sent: Tuesday, April 20, 2010 2:42 PM
To: Lebel, Marco
Cc: fo...@cfengine.com; help-cfengine@cfengine.org
Subject: Re: Cfengine Help: Re: RE: Cfengine Help: Re: rename on copy


I think you are trying to be too fancy. I would split the copy and rename into 
two promies
and write like this

    "/tmp/marco/.*/(.*)\.dr"

       rename            => mvto("$(match.1)");


Lebel, Marco wrote:
> So here is what I have tried:
> 
> body common control
> {
>    version      => "1.0.0";
>    inputs       => { "homeLibrary.cf" };
> 
>    bundlesequence  => { "rename_test" };
> }
> 
> bundle agent rename_test
> {
> files:
>    "/tmp/marco"
>       file_select       => include("(.*)\.dr"),
>       depth_search      => recurse("1"),
>       rename            => mvto("$(match.1)"),
>       copy_from         => cp("/tmp/marco/dr");
> }
> 
> body rename mvto(name)
> {
>    newname      => "$(name)";
> }
> 
> And I get the following:
> 
> !! Promise constraint conflicts - /tmp/marco cannot be renamed/moved and 
> exist there at the same time
> Promise (version 1.0.0) belongs to bundle 'rename_test' in file './rename.cf' 
> near line 13
>  !! Promise constraint conflicts - /tmp/marco cannot be renamed/moved and 
> exist there at the same time
> Promise (version 1.0.0) belongs to bundle 'rename_test' in file './rename.cf' 
> near line 13
>  !! Promise constraint conflicts - /tmp/marco cannot be renamed/moved and 
> exist there at the same time
> Promise (version 1.0.0) belongs to bundle 'rename_test' in file './rename.cf' 
> near line 13
> 
> 
> So my guess is that I am a sitting duck with this one :-(
> 
> Oh well time for a home made shell script!!!!
> 
> Marco
> 
> 
> -----Original Message-----
> From: help-cfengine-boun...@cfengine.org 
> [mailto:help-cfengine-boun...@cfengine.org] On Behalf Of fo...@cfengine.com
> Sent: Tuesday, April 20, 2010 1:38 PM
> To: help-cfengine@cfengine.org
> Subject: Cfengine Help: Re: RE: Cfengine Help: Re: rename on copy
> 
> Forum: Cfengine Help
> Subject: Re: RE: Cfengine Help: Re: rename on copy
> Author: Seva Gluschenko
> Link to topic: https://cfengine.com/forum/read.php?3,16933,16937#msg-16937
> 
> Neil,
> 
> Marco wants to convert foo.dr to foo, not vice versa. That is body rename 
> doesn't help, too. It would have been helpful if it would have allowed one to 
> use $(match.X).
> 
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
> _______________________________________________
> Help-cfengine mailing list
> Help-cfengine@cfengine.org
> https://cfengine.org/mailman/listinfo/help-cfengine
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine

Reply via email to