[chef] Re: Determining if a chef-client run is an initial chef-client run through handlers


Chronological Thread 
  • From: Michael Glenney < >
  • To: " " < >
  • Subject: [chef] Re: Determining if a chef-client run is an initial chef-client run through handlers
  • Date: Tue, 24 Feb 2015 07:33:44 -0700

While looking at resource counts would probably be mostly accurate (initial chef runs don't update 100% of resources but usually way more than re-runs) it would be problematic.

I would tap the 'registration_completed' handler method:

      def registration_completed
      end

This isn't necessarily going to be 100% accurate either but it should be "more" accurate.   An example of it not being accurate would be a node that was deleted from the chef server so it needs to reregister itself.  Not an "initial" run but would trigger this.  I think this is an edge case though as you generally wouldn't keep the validation pem around on an existing node so this wouldn't happen without you knowing about it.

Mike Glenney
New Context

On Mon, Feb 23, 2015 at 11:42 PM, Roger Lam < " target="_blank"> > wrote:
Hi,

I'm trying to count the number of initial chef-client runs through
handlers and my initial idea was to compare the number updated
resources with the total number of resources and if they're equal,
then it's an initial run. However, this is not the case most of the
time. Has anyone found a way to do this?
Thank you!

Roger




Archive powered by MHonArc 2.6.16.

§