chef-client icon indicating copy to clipboard operation
chef-client copied to clipboard

Make the onbootsec parameter to attribute

Open vineethp088 opened this issue 4 years ago • 3 comments

This is to make the OnBootSec parameter to control via attribute when the chef-client runs as a timer service,

Description

This is to make the OnBootSec parameter to control via attribute when the chef-client runs as a timer service. There are cases chef-client run after the boot is elapsed, becuase of the default 1min and there should be a mechanism to control this parameter. Changing this parameter to hgher value seems to be fixing this and should be control it via attribute, keeping 1 min as default.

Issues Resolved

There are cases chef-client run after the boot is elapsed, becuase of the default 1min and there should be a mechanism to control this parameter. Changing this parameter to higher value seems to be fixing this and should be control it via attribute, keeping 1 min as default.

Check List

vineethp088 avatar Aug 30 '20 13:08 vineethp088

Issue https://github.com/chef-cookbooks/chef-client/issues/627 probably be fixed by this PR

dheerajd-msys avatar Sep 03 '20 11:09 dheerajd-msys

I think this change is a good idea, but I don't think this is the right way to do it and this is complicated by what looks like a bug from confusing behavior.

  • The properties delay_after_boot, interval, and splay are eventually used as systemd time spans.
  • delay_after_boot and interval accept arbitrary strings, so they can be a number of seconds eg '60' or it can include time units eg 5h30m.
  • splay is coerced to an integer so it is assumed to be a number of seconds.

Appending sec onto the value specified for delay_after_boot in recipes/systemd_service.rb could end up with incorrect values like '5h30msec. That also means the current behavior of interpolating interval is incorrect. Since bare values are interpreted as seconds, the code in the recipe should probably use the values directly:

      'OnBootSec' => node['chef_client']['delay_after_boot'],
      'OnUnitInactiveSec' => node['chef_client']['interval'],
      'RandomizedDelaySec' => node['chef_client']['splay'],

phiggins avatar Sep 17 '20 17:09 phiggins

@vineethp088 Could you please make changes per suggestion here ? then I guess we would be good to merge the PR.

Thanks

dheerajd-msys avatar Dec 15 '20 13:12 dheerajd-msys