# Preventing the deletion of cache when running chef-client -o

**URL:** <https://discourse.chef.io/t/preventing-the-deletion-of-cache-when-running-chef-client-o/3897>\
**Category:** Chef Infra (archive)\
**Created:** [April 3, 2013, 8:04pm UTC](https://discourse.chef.io/t/preventing-the-deletion-of-cache-when-running-chef-client-o/3897 "2013-04-03T20:04:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Sibbitt](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@Chris\_Sibbitt](https://discourse.chef.io/u/Chris_Sibbitt)\
**Post date:** [April 3, 2013, 8:04pm UTC](https://discourse.chef.io/t/preventing-the-deletion-of-cache-when-running-chef-client-o/3897/1 "2013-04-03T20:04:17Z")

</div>

Hi Chefs.

When I do a `chef-client -o just_one_cookbook` it removes all the other cookbooks from the cache because they are “no longer needed on this client”. Then next time a scheduled run occurs all the cookbooks get downloaded again. For various reasons I’d rather this didn’t happen.

I tried putting this in the client.rb file:

cache\_options({ :skip\_expires =\> true})

But it does not affect this behavior.

Can anyone point me to a way of preventing this cache cleanup when using an run\_list override?

Thanks!

---

<div class="post-metadata">

**Author:** ![Ranjib](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/ranjib/32/1040_2.png) [@Ranjib](https://discourse.chef.io/u/Ranjib)\
**Post date:** [April 3, 2013, 8:10pm UTC](https://discourse.chef.io/t/preventing-the-deletion-of-cache-when-running-chef-client-o/3897/2 "2013-04-03T20:10:58Z")

</div>

try Chef::Config[:file\_cache\_path] to something other than the default one.  
I have used this trick to orchestrate multi-stage chef runs ,  
you can see some example here:

> <https://github.com/ranjib/chef-stage/blob/master/libraries/staged_chef_client.rb#L34>

if you want this to be done via command line, you might want to run the  
chef-client -o just\_one\_cookbook -c

 

regards  
ranjib

 

On Wed, Apr 3, 2013 at 1:04 PM, Chris Sibbitt  
 [csibbitt@thinkingphones.com](mailto:csibbitt@thinkingphones.com)wrote:

> Hi Chefs. \*\*\*\*
> 
> * * *
> 
> When I do a `chef-client –o just_one_cookbook` it removes all the other  
> cookbooks from the cache because they are “no longer needed on this  
> client”. Then next time a scheduled run occurs all the cookbooks get  
> downloaded again. For various reasons I’d rather this didn’t happen.\*\*\*\*
> 
> * * *
> 
> I tried putting this in the client.rb file:\*\*\*\*
> 
> * * *
> 
> cache\_options({ :skip\_expires =\> true})\*\*\*\*
> 
> * * *
> 
> But it does not affect this behavior.\*\*\*\*
> 
> * * *
> 
> Can anyone point me to a way of preventing this cache cleanup when using  
> an run\_list override?\*\*\*\*
> 
> * * *
> 
> Thanks!\*\*\*\*
> 
> * * *
