chef-cookbooks / chef_client_updater

Chef Cookbook to update the chef client on nodes
https://supermarket.chef.io/cookbooks/chef_client_updater
Apache License 2.0
54 stars 79 forks source link

The PowerShell to reschedule the upgrade does not work (Windows) #209

Closed jwdean closed 4 years ago

jwdean commented 4 years ago

When the chef_client_updater script's scheduled task runs, but is unable to proceed due to a running version of Ruby.exe, the task will fail to be properly rescheduled.

It is necessary to call $taskScheduler.Connect() prior to trying to use the $taskScheduler object, otherwise it is not initialized.

Additionally, and likely unrevealed due to this issue, is what seems like a logic fault. The reschedule logic sets the task to run x minutes from the last trigger time of the failed task. That may have the effect of scheduling the task to occur in the past. The task should be schedule to run xx minutes from current time.

Further, the task should likely be set to run as soon as possible if the trigger time is missed. (startWhenAvailable)

jwdean commented 4 years ago

I have a proposed fix for this issue... once I'm able to push it.

dheerajd-msys commented 4 years ago

It seems this is fixed via https://github.com/chef-cookbooks/chef_client_updater/pull/210