[chef] Re: how to know if a chef-client run is occuring


Chronological Thread 
  • From: Ranjib Dey < >
  • To:
  • Subject: [chef] Re: how to know if a chef-client run is occuring
  • Date: Wed, 21 Aug 2013 09:45:39 -0700

btw, knife status uses a node attribute called 'ohai_time', which is an automatic attribute, provided by ohai. You can use that if you want to check the last successfull chef run. Also, you can use the event handler for real time chef run progress.


On Wed, Aug 21, 2013 at 9:42 AM, Ranjib Dey < " target="_blank"> > wrote:
you mean in-flight chef runs? chef server cant say that, Chef 11 (may be 10.16 onward too) introduced file fcntl based locks while chef run is underway, to prevent concurrent chef runs, you can use knife ssh against the node in question and check if the lock is present, this will be a near real time indicator of any on going chef run.
default location of the lock file is Chef::Config[:file_cache_path]/chef-client-running.pid.

https://github.com/opscode/chef/blob/master/lib/chef/config.rb#L138
https://github.com/opscode/chef/blob/master/lib/chef/run_lock.rb#L45


On Wed, Aug 21, 2013 at 9:22 AM, Michael Hart < " target="_blank"> > wrote:
Is there a definitive way of querying the chef server to see if a chef-client run is occurring on a node? We've noticed that a "knife status" will return a timestamp of "382528 hours ago", or however many hours you are away from epoch, and but it's not entirely consistent and using that in code feels like a bit of a hack. Ideally I'd like an API to return true or false if a chef-client run is occurring. Thoughts?

cheers
mike

-- 
Michael Hart
Arctic Wolf Networks






Archive powered by MHonArc 2.6.16.

§