launchd.rb

Path: lib/puppet/provider/service/launchd.rb
Last Update: Wed Dec 09 12:54:29 -0800 2009

Required files

facter/util/plist  

Methods

Constants

Launchd_Paths = ["/Library/LaunchAgents", "/Library/LaunchDaemons", "/System/Library/LaunchAgents", "/System/Library/LaunchDaemons",]
Launchd_Overrides = "/var/db/launchd.db/com.apple.launchd/overrides.plist"

Public Class methods

returns a label => path map for either all jobs, or just a single job if the label is specified

Public Instance methods

enable and disable are a bit hacky. We write out the plist with the appropriate value rather than dealing with launchctl as it is unable to change the Disabled flag without actually loading/unloading the job. In 10.6 we need to write out a disabled key to the global overrides plist, in earlier versions this is stored in the job plist itself.

launchd jobs are enabled by default. They are only disabled if the key "Disabled" is set to true, but it can also be set to false to enable it. In 10.6, the Disabled key in the job plist is consulted, but only if there is no entry in the global overrides plist. We need to draw a distinction between undefined, true and false for both locations where the Disabled flag can be defined.

finds the path for a given label and returns the path and parsed plist as an array of [path, plist]. Note plist is really a Hash here.

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.

[Validate]