saltstack / saltstack/salt

[BUG] Issue with pkg.installed: version: '>=x.y.z'

Open
#60,470 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description of Issue

Issue on how salt.sls is implementing an equivalent of yum install 'foo >= 3.0.0-5' through the use of pkg.installed.

I have an rpm version >=3.0.0-5 on a minion. The salt state fails to recognize the existence of a new rpm.

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)

I tried 2 different versions of salt.sls on my master. As shown in this documentation page

Implementation 1:

'Install foo rpm':
  pkg.installed:
    - name: foo
    - version: '>=3.0.0-5'
    - require:
      - yum-make-cache

Implementation 2:

'Install foo rpm':
  pkg.installed:
    - pkgs:
      - foo: '>=3.0.0-5'
    - require:
      - yum-make-cache
Steps to Reproduce Issue

(Include debug logs if possible and relevant.)

To further debug this issue, I ran the salt-call with the debug flag on the minion and noticed this is what salt is implementing in the backend.

[ERROR   ] Command '['systemd-run', '--scope', 'yum', '-y', 'install', 'foo->=3.0.0-5']' failed with return code: 1
[ERROR   ] stdout: Running scope as unit run-32398.scope.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * redacted-repo-name1: redacted-ip:port1
 * redacted-repo-name2: redacted-ip:port2
No package foo->=3.0.0-5 available.
Error: Nothing to do
[ERROR   ] retcode: 1

Upon running the yum install foo->=3.0.0-5 as a linux command, it also expectedly fails, which leads me to suspect if that should be changed to yum install 'foo >= 3.0.0-5'.

Versions Report

(Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)

Master version: salt 3002.5
Minion version: salt 2019.2.4 (Fluorine)

Update:
OS info: CentOS 7

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

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 with the pkg.installed entry point and the yum backend, comparing the two SLS forms with the debug command shown in the issue. Reproduce the version constraint on CentOS 7 and verify that the resulting package-install behavior matches yum's expected syntax; the issue does not name specific files or tests.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.