class Chef::Resource::ChefClientSystemdTimer
Public Instance Methods
Source
# File lib/chef/resource/chef_client_systemd_timer.rb, line 138 def chef_client_cmd cmd = new_resource.chef_binary_path.dup cmd << " #{new_resource.daemon_options.join(" ")}" unless new_resource.daemon_options.empty? cmd << " --chef-license accept" if new_resource.accept_chef_license cmd << " -c #{::File.join(new_resource.config_directory, "client.rb")}" cmd end
The chef-client command to run in the systemd unit.
@return [String]
Source
# File lib/chef/resource/chef_client_systemd_timer.rb, line 168 def service_content unit = { "Unit" => { "Description" => new_resource.description, "After" => "network.target auditd.service", }, "Service" => { "Type" => "oneshot", "ExecStart" => chef_client_cmd, "SuccessExitStatus" => [3, 213, 35, 37, 41], }, "Install" => { "WantedBy" => "multi-user.target" }, } unit["Service"]["UMask"] = new_resource.service_umask if new_resource.service_umask unit["Service"]["ConditionACPower"] = "true" unless new_resource.run_on_battery unit["Service"]["CPUQuota"] = "#{new_resource.cpu_quota}%" if new_resource.cpu_quota unit["Service"]["Environment"] = new_resource.environment.collect { |k, v| "\"#{k}=#{v}\"" } unless new_resource.environment.empty? unit end
The service content to pass to the systemd_unit
@return [Hash]
Source
# File lib/chef/resource/chef_client_systemd_timer.rb, line 151 def timer_content { "Unit" => { "Description" => new_resource.description }, "Timer" => { "OnBootSec" => new_resource.delay_after_boot, "OnUnitActiveSec" => new_resource.interval, "RandomizedDelaySec" => new_resource.splay, }, "Install" => { "WantedBy" => "timers.target" }, } end
The timer content to pass to the systemd_unit
@return [Hash]