Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
PUP 7.8.0
-
Night's Watch
-
1
-
NW - 2021-07-28
-
Needs Assessment
-
ccaviness
-
Bug Fix
-
Fix an issue where the `launchd` service provider would fail if a parsable but invalid LaunchAgent or LaunchDaemon plist file exists.
-
Needs Assessment
Description
If a file in the LaunchAgents or LaunchDaemons paths is encountered that's parseable by Puppet::Util::Plist.read_plist_from_file but not a valid launchd plist file, then Puppet will crash with an error.
To reproduce:
# echo "aaa" >/Library/LaunchDaemons/invalid.txt
|
# puppet resource service
|
Error: Could not run: undefined method `has_key?' for "aaa":String
|
In launchd.rb line 141, the parsed plist (job) is checked with .has_key? to ensure a Label is present. If the parsed plist is not a Hash, though, this will fail.
I expect the correct course of action is to add a job.is_a?(Hash) check first.