- From: Roger Lam <
>
- To:
- Subject: [chef] Re: Re: Determining if a chef-client run is an initial chef-client run through handlers
- Date: Tue, 3 Mar 2015 16:53:23 -0800
Hi Mike and Chefs,
I found the 'registration_completed' method under the EventDispatch class.
http://www.rubydoc.info/github/chef/chef/master/Chef/EventDispatch/Base:registration_completed
There's a section in the Customizing Chef book that overrides event
methods and injects them with start handlers but that's not exactly
what I'm looking for. Ideally, the code would live in a single
cookbook and not spread to the client.rb or a separate gem as start
handlers require.
I'd love and really appreciate any ideas. Thanks!
Roger
On Tue, Feb 24, 2015 at 10:08 AM, Roger Lam
<
>
wrote:
>
Great idea! I'll give it a shot. Thank you Mike!
>
>
On Tue, Feb 24, 2015 at 6:33 AM, Michael Glenney
>
<
>
>
wrote:
>
> 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
>
> <
>
>
> 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
>
>
>
>
- [chef] Re: Re: Determining if a chef-client run is an initial chef-client run through handlers, Roger Lam, 03/03/2015
Archive powered by MHonArc 2.6.16.