Chef Client runs twice

I’m using the community chef client cookbook with the following recipes:

include_recipe "chef-client::init_service"
include_recipe “chef-client::config”

When my instance boots up, I’m running chef initially from a script, not as
a daemon. This is due to the recent change, where, when running as a
daemon, the client doesn’t start immediately, but seems to wait some
arbitrary amount of time before doing a run. On a newly booted instance,
this makes no sense.

After the cookbook rewrites the config file, it wants to rerun the client
again. I guess this is because the config file resource tells the service
to restart on update. Bottom line, when my initial chef-client runs, it
runs again, a second time. I’d like this not to happen.

Doug

Doug,

Looking at the code, its the init_service recipe that starts the
chef-client service once it creates the init.d file[0]. Is the second run
you’re referring to the chef-client service doing its initial run?

The config recipe will reload the client config[1]. That’s only done if
the [‘chef_client’][‘reload_config’] attribute = true[2].

Disabling the reload of the config is simple, the service when it starts up
will check in immediately though. I’m not aware of any way around that, but
my knowledge is very limited in that regard, so don’t trust me on that.

[0]


[1]

[2]

On Thu, Jun 18, 2015 at 11:04 AM, Douglas Garstang doug.garstang@gmail.com
wrote:

I’m using the community chef client cookbook with the following recipes:

include_recipe "chef-client::init_service"
include_recipe “chef-client::config”

When my instance boots up, I’m running chef initially from a script, not
as a daemon. This is due to the recent change, where, when running as a
daemon, the client doesn’t start immediately, but seems to wait some
arbitrary amount of time before doing a run. On a newly booted instance,
this makes no sense.

After the cookbook rewrites the config file, it wants to rerun the client
again. I guess this is because the config file resource tells the service
to restart on update. Bottom line, when my initial chef-client runs, it
runs again, a second time. I’d like this not to happen.

Doug


Galen