saltstack / saltstack/salt

[BUG] pkg.install wildcards not compatible with versionlock in redhat based OS

Open
#62,128 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description
When a package is version-locked by yum-versionlock, a pkg.installed state using a version containing a wildcard wont be able to detect the version and update the holds (when passing update_holds:; True)

Setup and steps
Say you have a package foobar-1.1 installed and you want to update it to an existing foobar-2.1 using the following state

  Update foobar:
    pkg:
    - hold: true
    - update_holds: true
    - allow_updates: true
    - name: foobar
    - version: 2.*
    - installed

if foobar is version locked to foobar-1.1, aka

root: # cat /etc/yum/pluginconf.d/versionlock.list

# Added locks on Mon May 30 13:53:28 2022
0:foobar-1.1.*

Salt will fail to detect the new version and thus wont update the locks (the to_install list inside the module pkg.install is empty`)

The state will fail with

          ID: Update foobar
    Function: pkg.installed
        Name: foobar
      Result: False
     Comment: Error occurred installing package(s). Additional info follows:
              
              errors:
                  - No version matching '2.1.*' found for package 'foobar' (available: none)
     Started: 06:59:29.108878
    Duration: 11602.897 ms
     Changes:
  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • 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

Expected behavior
when update_holds is passed the salt module pkg.install should remove the hold temporarily before trying to list the available package (the lazydict AvailablePackages).

Versions Report

Salt Version:
          Salt: 3002.6
 
Dependency Versions:
          cffi: 1.11.5
      cherrypy: unknown
      dateutil: 2.5.3
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.11.1
       libgit2: Not Installed
      M2Crypto: 0.35.2
          Mako: 1.1.2
       msgpack: 0.6.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.14
      pycrypto: Not Installed
  pycryptodome: Not Installed
        pygit2: Not Installed
        Python: 3.6.8 (default, Nov 16 2020, 16:55:22)
  python-gnupg: Not Installed
        PyYAML: 3.13
         PyZMQ: 17.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.1.4
 
System Versions:
          dist: centos 7 Core
        locale: UTF-8
       machine: x86_64
       release: 3.10.0-1160.el7.x86_64
        system: Linux
       version: CentOS Linux 7 Core

Also reproduced on salt 3004

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 by tracing the pkg.install entry point and the AvailablePackages lazydict on a Red Hat-based system using yum-versionlock. Reproduce the wildcard version case with update_holds enabled and inspect the versionlock.list behavior. Done means the held package can be detected and its lock updated before installation is attempted.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.