class Chef::Resource::ChefClientSystemdTimer

def chef_client_cmd

Returns:
  • (String) -
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

def service_content

Returns:
  • (Hash) -
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

def timer_content

Returns:
  • (Hash) -
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