[BUG] exec apkpkg.install(pkgs=[...]) and apk-based state pkg.removed(pkgs=[...]) don't work
Description
When I have a pkg.removed-state with multiple packages listed in the pkgs argument on my Alpine 3.17 minion the pkgs argument get's ignored and the minion tries to use the state's name as pkg name in most cases resulting in errors like "No such package: foo_deps_cleanup":
`salt -C "$MINION" state.sls bugs.apk_installed`
kvm-master:# cat bugs/apk_installed.sls
apkg_installed_state:
pkg.installed:
- pkgs:
- netcat-openbsd
- netcat-openbsd-doc
- sl
- tmux
- tmux-doc
kvm-master:/srv/salt/states.git# salt -C "$MINION" state.sls bugs.apk_installed
alpine317-kvm-minion:
----------
ID: apkg_installed_state
Function: pkg.installed
Result: True
Comment: 4 targeted packages were installed/updated.
The following packages were already installed: sl
Started: 10:08:37.420689
Duration: 2477.074 ms
Changes:
----------
libbsd:
----------
new:
0.11.7-r0
old:
libevent:
----------
new:
2.1.12-r5
old:
[...]
`salt -C "$MINION" state.sls bugs.apk_removed`
kvm-master:# cat bugs/apk_removed.sls
apkg_removed_state:
pkg.removed:
- pkgs:
- netcat-openbsd
- netcat-openbsd-doc
- sl
- tmux
- tmux-doc
kvm-master:# salt -C "$MINION" state.show_sls bugs.apk_removed
alpine317-kvm-minion:
----------
apkg_removed_state:
----------
__env__:
base
__sls__:
bugs.apk_removed
pkg:
|_
----------
pkgs:
- netcat-openbsd
- netcat-openbsd-doc
- sl
- tmux
- tmux-doc
- removed
|_
----------
order:
10000
kvm-master:# salt -C "$MINION" state.sls bugs.apk_removed
alpine317-kvm-minion:
----------
ID: apkg_removed_state
Function: pkg.removed
Result: False
Comment: Problem encountered removing package(s). Additional info follows:
errors:
- ERROR: No such package: apkg_removed_state
Started: 10:11:09.505411
Duration: 803.586 ms
Changes:
Summary for alpine317-kvm-minion
------------
Succeeded: 0
Failed: 1
------------
Total states run: 1
Total run time: 803.586 ms
ERROR: Minions returned with non-zero exit code
On the other hand running salt alpine317-kvm-minion pkg.remove pkgs='[tmux, tmux-doc]' works just fine but salt alpine317-kvm-minion pkg.install pkgs='[tmux, tmux-doc]' does nothing.:
kvm-master:~# salt alpine317-kvm-minion pkg.version tmux tmux-doc
alpine317-kvm-minion:
----------
tmux:
3.3a-r0
tmux-doc:
3.3a-r0
kvm-master:~# salt alpine317-kvm-minion pkg.remove pkgs='[tmux, tmux-doc]'
alpine317-kvm-minion:
----------
libevent:
----------
new:
old:
2.1.12-r5
tmux:
----------
new:
old:
3.3a-r0
tmux-doc:
----------
new:
old:
3.3a-r0
kvm-master:~# salt alpine317-kvm-minion pkg.install pkgs='[tmux, tmux-doc]'
alpine317-kvm-minion:
----------
kvm-master:~# salt alpine317-kvm-minion pkg.version tmux tmux-doc
alpine317-kvm-minion:
----------
tmux:
tmux-doc:
kvm-master:~#
Setup (Please provide relevant configs and/or SLS files (be sure to remove sensitive info. There is no general set-up of Salt.)
Please be as specific as possible and give set-up details.
- [x] on-prem machine
- [x] VM (Virtualbox, KVM, etc. please specify): Both master and minion are KVM guests on my local Debian workstation
- [ ] VM running on a cloud service, please be explicit and add details
- [ ] container (Kubernetes, Docker, containerd, etc. please specify)
- [ ] or a combination, please be explicit
- [ ] jails if it is FreeBSD
- [x] classic packaging (on the minion)
- [ ] onedir packaging (only on the master)
- [ ] used bootstrap to install
Steps to Reproduce the behavior Install an Alpine Linux 3.17 minion and copy the state files above to whereever you keep your states. Then try:
-
salt alpine-minion pkg.install pkgs='[tmux, tmux-doc]' -
salt alpine-minion state.sls bugs.apk_installed -
salt alpine-minion state.sls bugs.apk_removed -
salt alpine-minion pkg.remove pkgs='[tmux, tmux-doc]'
Expected behavior
Multiple packages getting installed via exec module apkpkg, multiple packages getting removed via apk-based state module pkg.
Screenshots If applicable, add screenshots to help explain your problem.
Versions Report
Master: `salt --versions-report`
Salt Version:
Salt: 3006.0
Python Version:
Python: 3.10.11 (main, Apr 14 2023, 05:57:16) [GCC 11.2.0]
Dependency Versions:
cffi: 1.14.6
cherrypy: unknown
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.2
libgit2: Not Installed
looseversion: 1.0.2
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.2
msgpack-pure: Not Installed
mysql-python: Not Installed
packaging: 22.0
pycparser: 2.21
pycrypto: Not Installed
pycryptodome: 3.9.8
pygit2: Not Installed
python-gnupg: 0.4.8
PyYAML: 5.4.1
PyZMQ: 23.2.0
relenv: 0.11.2
smmap: Not Installed
timelib: 0.2.4
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: debian 11 bullseye
locale: utf-8
machine: x86_64
release: 5.10.0-21-amd64
system: Linux
version: Debian GNU/Linux 11 bullseye
Minion: salt alpine317-kvm-minion test.versions_report
Salt Version:
Salt: 3005.1
Dependency Versions:
cffi: 1.15.1
cherrypy: Not Installed
dateutil: 2.8.2
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 3.1.2
libgit2: 1.5.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.4
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: 2.21
pycrypto: 3.15.0
pycryptodome: Not Installed
pygit2: 1.11.0
Python: 3.10.11 (main, Apr 6 2023, 01:16:54) [GCC 12.2.1 20220924]
python-gnupg: Not Installed
PyYAML: 6.0
PyZMQ: 23.2.1
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: alpine 3.17.3
locale: utf-8
machine: x86_64
release: 5.15.108-0-lts
system: Linux
version: Alpine Linux 3.17.3
Additional context
I didn't test the edge-version of Alpine with a salt-minion 3006.0 as apkpkg.py hasn't been touched since 2021. Running those states/functions via salt-call on the minion didn't make a difference.
PS: I hope I got the formating right, github is finicky with those <details> tags...