Repository navigation
Description
Description
On FreeBSD, if the minion config includes a providers section which sets it to use the pkgng provider for pkg states, some states which run after pkg states will fail. The zfs states are definitely affected, others may be as well.
See bug #51042 for an earlier report of a similar problem.
Setup
In the minion config add
providers:
pkg: pkgng
Test state file:
test package:
pkg.purged:
- pkgs:
- non_existent
test package 2:
pkg.purged:
- pkgs:
- non_existent_2
test zfs:
zfs.filesystem_absent:
- name: zroot/non/existent
Steps to Reproduce the behavior
Edit the minion config to include the providers section and restart. Attempt to apply the test state file. This will fail with this error:
The minion function caused an exception: Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/salt/minion.py", line 1890, in _thread_return
function_name, function_args, executors, opts, data
File "/usr/local/lib/python3.7/site-packages/salt/minion.py", line 1846, in _execute_job_function
return_data = self.executors[fname](opts, data, func, args, kwargs)
File "/usr/local/lib/python3.7/site-packages/salt/executors/direct_call.py", line 12, in execute
return func(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 800, in apply_
return sls(mods, **kwargs)
File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 1416, in sls
_set_retcode(ret, high_)
File "/usr/local/lib/python3.7/site-packages/salt/modules/state.py", line 111, in _set_retcode
if not __utils__["state.check_result"](ret, highstate=highstate):
File "/usr/local/lib/python3.7/site-packages/salt/utils/context.py", line 223, in __getitem__
return self._dict()[key]
KeyError: 'state.check_result'
and this in the minion log
2021-04-11 17:37:10,233 [salt.state :321 ][ERROR ][48229]
An exception occurred in this state: Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/salt/state.py", line 2154, in call
*cdata["args"], **cdata["kwargs"]
File "/usr/local/lib/python3.7/site-packages/salt/loader.py", line 2106, in wrapper
return f(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/salt/states/zfs.py", line 145, in filesystem_absent
ret = _absent(name, "filesystem", force, recursive)
File "/usr/local/lib/python3.7/site-packages/salt/states/zfs.py", line 96, in _absent
if __salt__["zfs.exists"](name, **{"type": dataset_type}):
File "/usr/local/lib/python3.7/site-packages/salt/modules/zfs.py", line 74, in exists
__utils__["zfs.zfs_command"](command="list", opts=opts, target=name,),
File "/usr/local/lib/python3.7/site-packages/salt/utils/context.py", line 223, in __getitem__
return self._dict()[key]
KeyError: 'zfs.zfs_command'
Expected behavior
States will apply without errors.
Versions Report
salt --versions-report
Salt Version:
Salt: 3002.6
Dependency Versions:
cffi: 1.14.5
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: 2.0.6
gitpython: 3.1.11
Jinja2: 2.11.2
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.20
pycrypto: Not Installed
pycryptodome: 3.10.1
pygit2: Not Installed
Python: 3.7.10 (default, Feb 28 2021, 23:13:15)
python-gnupg: Not Installed
PyYAML: 5.3.1
PyZMQ: 22.0.3
smmap: 2.0.5
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.1
System Versions:
dist: freebsd 11.4
locale: UTF-8
machine: amd64
release: 11.4-RELEASE-p4
system: FreeBSD
version: FreeBSD 11.4
Additional context
The providers setting on the minion was old config left over from when pkgng was not the default provider for FreeBSD. Deleting it has fixed the problem.
Activity
welcome commentedon Apr 11, 2021
Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey.
Please be sure to review our Code of Conduct. Also, check out some of our community resources including:
There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar.
If you have additional questions, email us at [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!
[-][BUG] States after pkg states fail on FreeBSD if the pkg provider is configured on the minion[/-][+][BUG] 3002.6 States after pkg states fail on FreeBSD if the pkg provider is configured on the minion[/+]