saltstack / saltstack/salt

[BUG] The pkg.list_repo_pkgs method ignores repo arguments

Open
#58,954 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug severity-high
Dominant language
Python
Stars
15.7k
Forks
5.6k
Avg merge
2d 44m
Merged PRs (30d)
80

Description

Description
On CentOS 7 or 8 machines, we configure 'excludes=kernel*' in /etc/yum.conf or /etc/dnf/dnf.conf to avoid unintentional upgrade of kernel related RPMs.
With such configuration when calling pkg.list_repo_pkgs with disableexcludes=main fails to list kernel RPMs.
E.g.

salt-call pkg.list_repo_pkgs kernel-modules-extra # fails correctly because kernel* is excluded
salt-call pkg.list_repo_pkgs kernel-modules-extra disableexcludes=main # fails incorrectly (due to unused repo_arg)
salt-call pkg.list_repo_pkgs kernel-modules-extra -- --disableexcludes=main # works however 2nd form above is used by pkg.installed and pkg.install state and execution methods, so those fail to install kernel-modules-extra until the bug is fixed.

https://github.com/saltstack/salt/blob/8df03c17e10940c029350d84b216a5ef5fb54351/salt/modules/yumpkg.py#L863

Setup

# Start a CentOS:8.1.1911 container
curl -o bootstrap-salt.sh -L https://bootstrap.saltstack.com
./bootstrap-salt.sh -P -M git v3002.1
echo 'excludes=kernel*' >> /etc/dnf/dnf.conf

Steps to Reproduce the behavior

salt-call pkg.list_repo_pkgs kernel-modules-extra disableexcludes=main

Expected behavior
The command under steps to reproduce should list kernel-modules-extra RPMs, however it returns empty.
Due to this issue, pkg.install and pkg.installed also fail when trying to get this RPM installed with disableexcludes=main option

Versions Report

salt --versions-report ``` Salt Version: Salt: 3002.1

Dependency Versions:
cffi: 1.11.5
cherrypy: Not Installed
dateutil: 2.6.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.2
libgit2: Not Installed
M2Crypto: Not Installed
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 1.0.0
mysql-python: Not Installed
pycparser: 2.14
pycrypto: 2.6.1
pycryptodome: 3.9.9
pygit2: Not Installed
Python: 3.6.8 (default, Nov 21 2019, 19:31:34)
python-gnupg: Not Installed
PyYAML: 5.3.1
PyZMQ: 20.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.3

System Versions:
dist: centos 8 Core
locale: UTF-8
machine: x86_64
release: 4.18.0-147.el8.x86_64
system: Linux
version: CentOS Linux 8 Core

</details>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at salt/modules/yumpkg.py around the linked line and reproduce the behavior with salt-call pkg.list_repo_pkgs on CentOS with excludes=kernel* configured. Verify that passing disableexcludes=main lists kernel-modules-extra RPMs and that the same option no longer prevents pkg.install and pkg.installed from installing it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, infrastructure
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.