help-cfengine
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using tidy + rmdirs to delete a directory and its contents


From: Mark . Burgess
Subject: Re: Using tidy + rmdirs to delete a directory and its contents
Date: Sun, 23 Jan 2005 08:53:43 +0100 (MET)

Thanks a lot, Eric, (note your patch was missing)

M

On 22 Jan, Eric Sorenson wrote:
> On Mon, 27 Dec 2004, Josh Smith wrote:
> 
>> I'm trying to use tidy and rmdirs to delete a directory and everything in
>> it, and having some trouble doing so.
>> 
>> I first tried a 'tidy' block with
>> 
>>   /etc/yum.repos.d pattern=* recurse=inf age=0 rmdirs=true 
>> 
>> which worked the first time, but the next run, complained that the
>> directory wasn't there; and on the run after that, complained
>> 
>>   Couldn't obtain lock for 
>> lock._var_cfengine_mf_cfengine_cfagent_conf_generic..tidy.tidy_2138
>>   (already running!)
> 
> Ok, I repeated this problem, my config uses yum.repos.e so as not to nuke
> my actual hard-fought yum.repos.d directory :)
> 
>   control:
>     actionsequence = ( tidy )
>   tidy:
>     /etc/yum.repos.e  pattern=* recurs=inf age=0 rmdirs=true
> 
> Run 1, Purges the files and deletes the /etc/yum.repos.e directory itself
> Run 2, says
>     cfengine:amine: Tidy directory /etc/yum.repos.e cannot be accessed
> Run 3, says
>     Couldn't obtain lock for lock.cfagent_conf.amine.tidy.tidy_2139 (already 
> running!)
> 
> So the error is in the second run, where we leave the tidy section without
> releasing the lock. The attached patch fixes three sanity checks that will
> return to the calling function without a ReleaseLock(). The patch is against
> the current snap but it does apply with an offset to 2.1.11; I'd suggest
> trying that to keep your overall delta to a minimum.
> 
> Remember to remove your /var/cfengine/cfengine_lock_db or the staleness
> will linger.
> 
>> http://www.cfengine.org/docs/cfengine-Reference.html#tidy vaguely implies
>> that I might want rmdirs=all rather than rmdirs=true, although it's not
>> very specific about that -- it says "If this option is set to `true' then
>> cfengine will delete any directories which are empty", but it doesn't say
>> what it does if the option is set to 'all'.
> 
> According to the code, 'true' or 'all' are the same thing. 'false' or
> 'none' are acceptable, and 'sub' only removes subdirectories, leaving
> the topmost dir (/etc/yum.repos.e in our example) intact. The docs should
> probably say something like
> 
> -rmdirs=true/false/all/sub
> +rmdirs= [ true | all ] / [ false / none ] / sub
> 
> Hope this helps. Pop by #cfengine on irc.freenode.net if you're still having
> trouble.
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Work: +47 22453272            Email:  address@hidden
Fax : +47 22453205            WWW  :  http://www.iu.hio.no/~mark
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





reply via email to

[Prev in Thread] Current Thread [Next in Thread]