Skip to content

Commit

Permalink
Make the onbootsec parameter to attribute
Browse files Browse the repository at this point in the history
Signed-off-by: vineethp08 <[email protected]>
  • Loading branch information
vineethp08 committed Aug 30, 2020
1 parent f54bfd9 commit 61bfe68
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
default['chef_client']['log_file'] = 'client.log'
default['chef_client']['interval'] = '1800'
default['chef_client']['splay'] = '300'
default['chef_client']['delay_after_boot'] = '60'
default['chef_client']['conf_dir'] = '/etc/chef'
default['chef_client']['bin'] = '/opt/chef/bin/chef-client'

Expand Down
2 changes: 1 addition & 1 deletion recipes/systemd_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class ::Chef::Recipe
'Unit' => { 'Description' => 'chef-client periodic run' },
'Install' => { 'WantedBy' => 'timers.target' },
'Timer' => {
'OnBootSec' => '1min',
'OnBootSec' => "#{node['chef_client']['delay_after_boot']}sec",
'OnUnitInactiveSec' => "#{node['chef_client']['interval']}sec",
'RandomizedDelaySec' => "#{node['chef_client']['splay']}sec",
}
Expand Down
2 changes: 1 addition & 1 deletion resources/systemd_timer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

property :user, String, default: 'root'

property :delay_after_boot, String, default: '1min'
property :delay_after_boot, String, default: '60sec'
property :interval, String, default: '30min'
property :splay, [Integer, String], default: 300,
coerce: proc { |x| Integer(x) },
Expand Down
2 changes: 1 addition & 1 deletion test/integration/timer_systemd/timer_systemd_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

control 'has expected unit content' do
describe file('/etc/systemd/system/chef-client.timer') do
its('content') { should match 'OnBootSec = 1min' }
its('content') { should match 'OnBootSec = 60sec' }
its('content') { should match 'OnUnitInactiveSec = 1800sec' }
its('content') { should match 'RandomizedDelaySec = 300sec' }
end
Expand Down

0 comments on commit 61bfe68

Please sign in to comment.