We had the same requirement in our environment, that is, the ability to
purge against a single file copy rule. Attached is a patch file we're
using against 2.2.10 to support this kind of behavior. It works for both
local and server-side copy rules. Just apply the patch to 'src/do.c'.
Mark, if you'd like to integrate this into any future cfengine-2
maintenance releases I'll send an email to bug-cfengine.
-Chris
On Fri, 8 Jan 2010, nwat...@symcor.com wrote:
To me the promise says make sure this file is present on the client. If
the source file goes missing I'm not sure it is wise to have it
automatically removed from the client.
Sincerely,
--
Neil Watson
416-673-3465
Tom Van de Velde <tom_vandeve...@yahoo.com>
2010-01-08 08:52
To
nwat...@symcor.com
cc
help-cfengine@cfengine.org, help-cfengine-boun...@cfengine.org
Subject
Re: Problem with purge and failover in copy statement
Neil,
I came to te exact same conclusion :-) ...
So I tried to do some funcky class setting and set up a tidy behind, but
even there cfengine is failing on me ;-)
I can see in the debug output that the file is not there, he gives an
error but the classes are not set correctly so my tidy action is not
activated...
It seems like a trivial problem for cfengine, nevertheless I spended
already some time in investigating this ...
Regards,
Tom
--- On Fri, 1/8/10, nwat...@symcor.com <nwat...@symcor.com> wrote:
From: nwat...@symcor.com <nwat...@symcor.com>
Subject: Re: Problem with purge and failover in copy statement
To: "Tom Van de Velde" <tom_vandeve...@yahoo.com>
Cc: help-cfengine@cfengine.org, help-cfengine-boun...@cfengine.org
Date: Friday, January 8, 2010, 2:40 PM
I think that purge only works with
recursive copies.
Sincerely,
--
Neil Watson
416-673-3465
-----Inline Attachment Follows-----
CONFIDENTIALITY WARNING
This communication, including any attachments, is for the
exclusive use of addressee and may contain proprietary
and/or confidential information. If you are not the intended
recipient, any use, copying, disclosure, dissemination or
distribution is strictly prohibited. If you are not the
intended recipient, please notify the sender immediately by
return e-mail, delete this communication and destroy all
copies.
AVERTISSEMENT RELATIF À LA CONFIDENTIALITÉ
Ce message, ainsi que les pièces qui y sont jointes, est
destiné à l?usage exclusif de la personne à laquelle il
s?adresse et peut contenir de l?information personnelle
ou confidentielle. Si le lecteur de ce message n?en est
pas le destinataire, nous l?avisons par la présente que
toute diffusion, distribution, reproduction ou utilisation
de son contenu est strictement interdite. Veuillez avertir
sur-le-champ l?expéditeur par retour de courrier
électronique et supprimez ce message ainsi que toutes les
pièces jointes.
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine
*** src/do.c 2009-03-08 09:27:56.000000000 -0700
--- src/do.c.updated 2010-01-13 14:25:13.000000000 -0800
***************
*** 2574,2588 ****
ResetOutputRoute(ip->log,ip->inform);
! if (cfstat(path,&statbuf,ip) == -1)
! {
snprintf(OUTPUT,CF_BUFSIZE*2,"Can't stat %s in copy\n",path);
CfLog(cfverbose,OUTPUT,"");
SILENT = savesilent;
ResetOutputRoute('d','d');
continue;
}
-
snprintf(vbuff,CF_BUFSIZE,"%.255s.%.50s_%.50s",path,destination,server); /* Unique ID for copy locking */
if (!GetLock(ASUniqueName("copy"),CanonifyName(vbuff),ip->ifelapsed,ip->expireafter,VUQNAME,CFSTARTTIME))
--- 2574,2596 ----
ResetOutputRoute(ip->log,ip->inform);
! if (cfstat(path,&statbuf,ip) == -1) {
! //path not found. if purge is true, remove the destination
! // if permission allows and destination is a file
! // if destination is a directory, it will not be removed
! if (ip->purge == 'y' && unlink(destination) == 0) {
! //remove the destination successful
! snprintf(OUTPUT,CF_BUFSIZE*2,
! "Can't stat %s in copy, %s removed\n",
! path, destination);
! } else {
snprintf(OUTPUT,CF_BUFSIZE*2,"Can't stat %s in copy\n",path);
+ }
CfLog(cfverbose,OUTPUT,"");
SILENT = savesilent;
ResetOutputRoute('d','d');
continue;
}
snprintf(vbuff,CF_BUFSIZE,"%.255s.%.50s_%.50s",path,destination,server); /* Unique ID for copy locking */
if (!GetLock(ASUniqueName("copy"),CanonifyName(vbuff),ip->ifelapsed,ip->expireafter,VUQNAME,CFSTARTTIME))
_______________________________________________
Help-cfengine mailing list
Help-cfengine@cfengine.org
https://cfengine.org/mailman/listinfo/help-cfengine