_available_services from launchctl module fails #8759
Labels
Bug
broken, incorrect, or confusing behavior
fixed-pls-verify
fix is linked, bug author to confirm fix
Milestone
Anything that calls _available_services in the launchctl module seems to fail. I closely followed the steps in the HACKING.rst file to set up my environment. When I ran salt-call -c "path_to_config_directory" service.get_all, which calls _available_services, this is what I got:
[INFO ] Executing command 'launchctl list' in directory '/Users/demitriswan'
[INFO ] Executing command '/usr/bin/plutil -convert xml1 -o - -- "/Library/LaunchAgents/com.oracle.java.Java-Updater.plist"' in directory '/Users/demitriswan'
[ERROR ] Command '/usr/bin/plutil -convert xml1 -o - -- "/Library/LaunchAgents/com.oracle.java.Java-Updater.plist"' failed with return code: 1
[ERROR ] stdout: /Library/LaunchAgents/com.oracle.java.Java-Updater.plist: file does not exist or is not readable or is not a regular file
[ERROR ] An un-handled exception was caught by salt's global exception handler:
ExpatError: not well-formed (invalid token): line 1, column 0
Traceback (most recent call last):
File "/usr/local/bin/salt-call", line 9, in
load_entry_point('salt==0.17.2', 'console_scripts', 'salt-call')()
File "/Library/Python/2.7/site-packages/salt/scripts.py", line 77, in salt_call
client.run()
File "/Library/Python/2.7/site-packages/salt/cli/init.py", line 303, in run
caller.run()
File "/Library/Python/2.7/site-packages/salt/cli/caller.py", line 135, in run
ret = self.call()
File "/Library/Python/2.7/site-packages/salt/cli/caller.py", line 78, in call
ret['return'] = func(_args, *_kwargs)
File "/Library/Python/2.7/site-packages/salt/modules/launchctl.py", line 110, in get_all
service_labels_from_services = _available_services().keys()
File "/Library/Python/2.7/site-packages/salt/utils/decorators.py", line 192, in _memoize
cache[args] = func(*args)
File "/Library/Python/2.7/site-packages/salt/modules/launchctl.py", line 56, in _available_services
plist = plistlib.readPlistFromString(plist_xml)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 103, in readPlistFromString
return readPlist(StringIO(data))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 78, in readPlist
rootObject = p.parse(pathOrFile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 406, in parse
parser.ParseFile(fileobj)
ExpatError: not well-formed (invalid token): line 1, column 0
Traceback (most recent call last):
File "/usr/local/bin/salt-call", line 9, in
load_entry_point('salt==0.17.2', 'console_scripts', 'salt-call')()
File "/Library/Python/2.7/site-packages/salt/scripts.py", line 77, in salt_call
client.run()
File "/Library/Python/2.7/site-packages/salt/cli/init.py", line 303, in run
caller.run()
File "/Library/Python/2.7/site-packages/salt/cli/caller.py", line 135, in run
ret = self.call()
File "/Library/Python/2.7/site-packages/salt/cli/caller.py", line 78, in call
ret['return'] = func(_args, *_kwargs)
File "/Library/Python/2.7/site-packages/salt/modules/launchctl.py", line 110, in get_all
service_labels_from_services = _available_services().keys()
File "/Library/Python/2.7/site-packages/salt/utils/decorators.py", line 192, in _memoize
cache[args] = func(*args)
File "/Library/Python/2.7/site-packages/salt/modules/launchctl.py", line 56, in _available_services
plist = plistlib.readPlistFromString(plist_xml)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 103, in readPlistFromString
return readPlist(StringIO(data))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 78, in readPlist
rootObject = p.parse(pathOrFile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 406, in parse
parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 0
I tried running the command as root and got very similar output, which – I assume – would rule out a permissions issue. Looks like it doesn't handle symbolic links in _launchd_paths properly. This is the ls output I get on that file:
lrwxr-xr-x 1 root wheel 104B Feb 15 2013 /Library/LaunchAgents/com.oracle.java.Java-Updater.plist -> /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Resources/com.oracle.java.Java-Updater.plist
Perhaps the exception needs to follow symbolic links.
The text was updated successfully, but these errors were encountered: