57: def self.jobsearch(label=nil)
58: label_to_path_map = {}
59: Launchd_Paths.each do |path|
60: if FileTest.exists?(path)
61: Dir.entries(path).each do |f|
62: next if f =~ /^\..*$/
63: next if FileTest.directory?(f)
64: fullpath = File.join(path, f)
65: job = Plist::parse_xml(fullpath)
66: if job and job.has_key?("Label")
67: if job["Label"] == label
68: return { label => fullpath }
69: else
70: label_to_path_map[job["Label"]] = fullpath
71: end
72: end
73: end
74: end
75: end
76:
77:
78: if label
79: raise Puppet::Error.new("Unable to find launchd plist for job: #{label}")
80: end
81:
82: label_to_path_map
83: end