[chef] Re: Cleaning up Cron (or other resources)


Chronological Thread 
  • From: Peter Donald < >
  • To: " " < >
  • Subject: [chef] Re: Cleaning up Cron (or other resources)
  • Date: Tue, 22 May 2012 07:41:47 +1000

Hi,

We use the following approaches for removal of resources;

- ignore them and wait for a destruction cycle to clear them out. I.e. if you assume that your nodes are transient and will undergo destruction in near future and be rebuilt from scratch when needed and will have correct resource arrangement
- have negative resource declarations in the policy. I.e. declare a resource with :delete action. (useful for things like users)
- cache the names of resources created in last run as propeerties and then compare the current run with last run and remove any that are missing
- make a directory etc completely managed by chef and nuke any that we're didn't update this run


HTH 

Ignore the iOS autocorrect snafus

On Tuesday, May 22, 2012, Seth Vargo wrote:
Hello,

I'm currently writing a script that creates various crontabs based on an attribute like so:

paths.each do |path|
  cron "my-cookbook-#{path}" do
    command "/usr/sbin/task #{path}"
  end
end

This works fine. However, if I remove something from that path, it isn't actually removed in the crontab, since Chef has no way of knowing that I "removed" it from my array. How are people handling this? I could manually delete the cron, but that seems backwards.

Seth


--
Cheers,

Peter Donald



Archive powered by MHonArc 2.6.16.

§