[FreeBSD] pkg broken in 10.0-RELEASE
I've upgraded to 10.0-RELEASE at it seems with both 0.17.4 and 0.17.5, the pkg module is broken:
FreeBSD 10.0 system using salt 0.17.5:
[root@server states]> uname -a
FreeBSD server.m87-blackhole.org 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
[root@server states]> salt --versions-report
Salt: 0.17.5
Python: 2.7.6 (default, Dec 12 2013, 17:19:47)
Jinja2: 2.7.1
M2Crypto: 0.21.1
msgpack-python: 0.4.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
PyYAML: 3.10
PyZMQ: 14.0.1
ZMQ: 4.0.3
FreeBSD 10.0 system using salt 0.17.4
root@fbsd-qa:~ # uname -a
FreeBSD fbsd-qa.discdrive.bayphoto.com 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
root@fbsd-qa:~ # salt --versions-report
Salt: 0.17.4
Python: 2.7.6 (default, Dec 12 2013, 17:19:47)
Jinja2: 2.7.1
M2Crypto: 0.21.1
msgpack-python: 0.4.0
msgpack-pure: Not Installed
pycrypto: 2.6.1
PyYAML: 3.10
PyZMQ: 14.0.1
ZMQ: 4.0.3
pkg module traceback:
[root@server states]> salt-call pkg.list_pkgs
[INFO ] Executing command '/sbin/zfs help || :' in directory '/root'
[INFO ] Executing command 'None' in directory '/root'
[ERROR ] An un-handled exception was caught by salt's global exception handler:
ValueError: need more than 1 value to unpack
Traceback (most recent call last):
File "/usr/local/bin/salt-call", line 8, in <module>
load_entry_point('salt==0.17.5', 'console_scripts', 'salt-call')()
File "/usr/local/lib/python2.7/site-packages/salt/scripts.py", line 77, in salt_call
client.run()
File "/usr/local/lib/python2.7/site-packages/salt/cli/__init__.py", line 303, in run
caller.run()
File "/usr/local/lib/python2.7/site-packages/salt/cli/caller.py", line 135, in run
ret = self.call()
File "/usr/local/lib/python2.7/site-packages/salt/cli/caller.py", line 78, in call
ret['return'] = func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/salt/modules/freebsdpkg.py", line 187, in list_pkgs
pkg, ver = line.split(' ')[0].rsplit('-', 1)
ValueError: need more than 1 value to unpack
Traceback (most recent call last):
File "/usr/local/bin/salt-call", line 8, in <module>
load_entry_point('salt==0.17.5', 'console_scripts', 'salt-call')()
File "/usr/local/lib/python2.7/site-packages/salt/scripts.py", line 77, in salt_call
client.run()
File "/usr/local/lib/python2.7/site-packages/salt/cli/__init__.py", line 303, in run
caller.run()
File "/usr/local/lib/python2.7/site-packages/salt/cli/caller.py", line 135, in run
ret = self.call()
File "/usr/local/lib/python2.7/site-packages/salt/cli/caller.py", line 78, in call
ret['return'] = func(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/salt/modules/freebsdpkg.py", line 187, in list_pkgs
pkg, ver = line.split(' ')[0].rsplit('-', 1)
ValueError: need more than 1 value to unpack
This is the same output for all module commands, install, list_pkgs, etc...
After a little more digging, I think I've found the culprit
on line 31 of freebsdpkg.py:
return os.path.isfile('/usr/local/etc/pkg.conf')
FreeBSD 10 does not have that file, since pkgng is completely integrated into the base os, the correct location is:
/etc/pkg/
But, pkg.conf is ALSO depreciated, so on a 10.0-RELEASE system you will fine:
/etc/pkg/FreeBSD.conf
Now that I compare it to the latest in the development branch, salt is no longer checking for /usr/local/etc/pkg.conf, and it was changed in the 0.17 branch to at least look for /var/db/pkg/local.sqlite
So this is not an issue for future releases, but it is currently broken in the official package.
Perhaps I'll see about updating the port in FreeBSD, create a 0.17.5,1 port that patches salt/modules/freebsdpkg.py to not use /usr/local/etc/pkg.conf.
This is a bug in the committed FreeBSD port:
--- salt/modules/freebsdpkg.py.orig 2013-10-30 16:16:31.850225522 +0000
+++ salt/modules/freebsdpkg.py 2013-10-30 16:16:47.868224728 +0000
@@ -27,7 +27,7 @@
'''
Looks to see if pkgng is being used by checking if database exists
'''
- return os.path.isfile('/var/db/pkg/local.sqlite')
+ return os.path.isfile('/usr/local/etc/pkg.conf')
@decorators.memoize
Checking for /var/db/pkg/local.sqlite works on all versions using pkgng.
I'll open up a FreeBSD PR and close this. Sorry for the noise!