lib/puppet/provider/service/launchd.rb
# start the service. To get to a state of running/enabled, we need to
# conditionally enable at load, then disable by modifying the plist file
# directly.
start the service. To get to a state of running/enabled, we need to
conditionally enable at load, then disable by modifying the plist file
directly.
start the service . To get to a state of running / enabled we need to conditionally enable at load then disable by modifying the plist file directly .
def start
    return ucommand(:start) if resource[:start]
    job_path, job_plist = plist_from_label(resource[:name])
    did_enable_job = false
    cmds = []
    cmds << :launchctl << :load
    if self.enabled? == :false  || self.status == :stopped 
      cmds << "-w"
      did_enable_job = true
    end
    cmds << job_path
    begin
      execute(cmds)
    rescue Puppet::ExecutionFailure
      raise Puppet::Error.new("Unable to start service: #{resource[:name]} at path: #{job_path}")
    end
    self.disable if did_enable_job and resource[:enable] == :false
  end
def start return ucommand ( :start ) if resource [ :start ] job_path , job_plist = plist_from_label ( resource [ :name ] ) did_enable_job = false cmds = [ ] cmds << :launchctl << :load if self . enabled? == :false || self . status == :stopped cmds << "-w" did_enable_job = true end cmds << job_path begin execute ( cmds ) rescue Puppet :: ExecutionFailure raise Puppet :: Error . new ( "Unable to start service: #{resource[:name]} at path: #{job_path}" ) end self . disable if did_enable_job and resource [ :enable ] == :false end
start the service.
start the service .
# launchctl won't load disabled jobs # As load -w clears the Disabled flag, we need to add it in after