saltstack / saltstack/salt

state pkg.installed fails when using wildcard '*' in version for el7_5.1 release

Open
#51,137 0 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/Question

Attempting to run pkg.installed state with name:'gcc-gfortran' and version:'4.8.5-28.el7*' fails when actual package version is: 4.8.5-28.el7_5.1
Seems to be related to not looking in the proper repo when wild card is used

Why can salt not install the package if the wildcard is used, but works when specifying the complete version?

Setup

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

Steps to Reproduce Issue
salt "minion" state.single pkg.installed name='gcc-gfortran' version="4.8.5-28.el7*"
----------
          ID: gcc-gfortran
    Function: pkg.installed
      Result: False
     Comment: Error occurred installing package(s). Additional info follows:
              
              errors:
                  - No version matching '4.8.5-28.el7*' found for package 'gcc-gfortran' (available: none)
     Started: 08:39:22.919816
    Duration: 12204.592 ms
     Changes: 
salt "minion" pkg.latest_version gcc-gfortran
4.8.5-28.el7_5.1

when running the install above as a salt-call with debug I see that salt runs:

[INFO    ] Executing command ['yum', '--quiet', '--showduplicates', 'repository-packages', 'x', 'list', 'gcc-gfortran'] in directory '/home/root'

And does this for each of the repos defined in /etc/yum.repos.d

Running the same command with the exact version results in a success.

[INFO    ] Executing command ['systemd-run', '--scope', 'yum', '-y', 'install', 'gcc-gfortran-4.8.5-28.el7_5.1'] in directory '/home/root'
[INFO    ] Executing command ['rpm', '-qa', '--queryformat', '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)'] in directory '/home/root'
[DEBUG   ] Could not LazyLoad pkg.version_clean: 'pkg.version_clean' is not available.
[INFO    ] Made the following changes:
'gcc-gfortran' changed from 'absent' to '4.8.5-28.el7_5.1'
'libquadmath-devel' changed from 'absent' to '4.8.5-28.el7_5.1'
----------
          ID: gcc-gfortran
    Function: pkg.installed
      Result: True
     Comment: 1 targeted package was installed/updated.
     Started: 08:42:06.226108
    Duration: 13764.925 ms
     Changes:   
              ----------
              gcc-gfortran:
                  ----------
                  new:
                      4.8.5-28.el7_5.1
                  old:
              libquadmath-devel:
                  ----------
                  new:
                      4.8.5-28.el7_5.1
                  old:

Running: rpm -qa --queryformat '%{NAME}_|-%{EPOCH}_|-%{VERSION}_|-%{RELEASE}_|-%{ARCH}_|-(none)' and looking only for gcc-gfortran
gcc-gfortran_|-(none)_|-4.8.5_|-28.el7_5.1_|-x86_64_|-(none)

pkg.list_repo_pkgs does not list gcc-gfortran
list_repos does not list the repo that the package belongs to, but that repo is not defined in /etc/yum.repos.d

Using fromrepo='rhel7-201810-x86_64' in the pkg.installed state works.

Versions Report

Salt Version:
Salt: 2017.7.7

Dependency Versions:
cffi: 1.11.5
cherrypy: Not Installed
dateutil: 1.5
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
ioflo: Not Installed
Jinja2: 2.7.2
libgit2: 0.26.5
libnacl: Not Installed
M2Crypto: 0.28.2
Mako: Not Installed
msgpack-pure: Not Installed
msgpack-python: 0.4.6
mysql-python: Not Installed
pycparser: 2.18
pycrypto: 2.6.1
pycryptodome: 3.6.1
pygit2: 0.26.3
Python: 2.7.5 (default, May 31 2018, 09:41:32)
python-gnupg: Not Installed
PyYAML: 3.11
PyZMQ: 15.3.0
RAET: Not Installed
smmap: Not Installed
timelib: Not Installed
Tornado: 4.2.1
ZMQ: 4.1.4

System Versions:
dist: redhat 7.5 Maipo
locale: UTF-8
machine: x86_64
release: 3.10.0-862.14.4.el7.x86_64
system: Linux
version: Red Hat Enterprise Linux Server 7.5 Maipo

minion on same salt version and RHEL version

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 and pkg.latest_version paths for the yum provider, then reproduce the wildcard command shown in the issue and compare it with the exact-version and fromrepo cases. Check how pkg.list_repo_pkgs and list_repos handle repositories; done means a wildcard version such as 4.8.5-28.el7* resolves the available package and installs it successfully.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.