saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.1k stars 5.47k forks source link

[BUG] version of yumpkg.installed works abnormally. #66059

Open DdangJin opened 7 months ago

DdangJin commented 7 months ago

Description version of pkg.installed in yum environment works abnormally.

If include an arch in the version, yumpkg.installed attempts to install using = rather than -. (1.24.0-1.el7.ngx.x86_64) If there is no arch, it works fine. (1.24.0-1.el7.ngx)

Setup Please be as specific as possible and give set-up details.

yumpkg_installed.sls

occur-error:
  pkg.installed:
    - name: nginx
    - version: 1.24.0-1.el7.ngx.x86_64

Steps to Reproduce the behavior (Include debug logs if possible and relevant)

If you put arch in the version of yumpkg.installed state, you can see the following error. It works normally if you don't put it in.

result

Function: pkg.installed
  Result: False
 Comment: The following packages failed to install/update: nginx=1.24.0-1.el7.ngx.x86_64

Expected behavior A clear and concise description of what you expected to happen.

Try installing with nginx-1.24.0-1.el7.ngx.x86_64 rather than nginx=1.24.0-1.el7.ngx.x86_64

Screenshots If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (master) ```yaml Salt Version: Salt: 3005.1 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.0 libgit2: Not Installed M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: Not Installed Python: 3.9.16 (main, Jan 6 2023, 22:49:49) python-gnupg: 0.4.8 PyYAML: 5.4.1 PyZMQ: 23.2.0 smmap: Not Installed timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: ubuntu 18.04 bionic locale: utf-8 machine: x86_64 release: 4.15.0-20-generic system: Linux version: Ubuntu 18.04 bionic ```
salt-minion --versions-report (minion) ```yaml Salt Version: Salt: 3005.1 Dependency Versions: cffi: 1.14.6 cherrypy: 18.6.1 dateutil: 2.8.1 docker-py: Not Installed gitdb: Not Installed gitpython: Not Installed Jinja2: 3.1.0 libgit2: Not Installed M2Crypto: Not Installed Mako: Not Installed msgpack: 1.0.2 msgpack-pure: Not Installed mysql-python: Not Installed pycparser: 2.21 pycrypto: Not Installed pycryptodome: 3.9.8 pygit2: Not Installed Python: 3.9.16 (main, Jan 6 2023, 22:51:58) python-gnupg: 0.4.8 PyYAML: 5.4.1 PyZMQ: 23.2.0 smmap: Not Installed timelib: 0.2.4 Tornado: 4.5.3 ZMQ: 4.3.4 System Versions: dist: centos 7 Core locale: utf-8 machine: x86_64 release: 3.10.0-957.21.3.el7.x86_64 system: Linux version: CentOS Linux 7 Core ```

Additional context When installing by specifying the version in the name, even if there is no arch, an error occurs even though the installation was actually successful.

yumpkg_installed.sls

occur-error:
  pkg.installed:
    - name: nginx-1.24.0-1.el7.ngx.x86_64

result

Function: pkg.installed
    Name: nginx-1.24.0-1.el7.ngx.x86_64
  Result: False
 Comment: The following packages failed to install/update: nginx-1.24.0-1.el7.ngx
welcome[bot] commented 7 months ago

Hi there! Welcome to the Salt Community! Thank you for making your first contribution. We have a lengthy process for issues and PRs. Someone from the Core Team will follow up as soon as possible. In the meantime, here’s some information that may help as you continue your Salt journey. Please be sure to review our Code of Conduct. Also, check out some of our community resources including:

There are lots of ways to get involved in our community. Every month, there are around a dozen opportunities to meet with other contributors and the Salt Core team and collaborate in real time. The best way to keep track is by subscribing to the Salt Community Events Calendar. If you have additional questions, email us at saltproject@vmware.com. We’re glad you’ve joined our community and look forward to doing awesome things with you!

whytewolf commented 4 months ago

so, digging into this i have found the issue. the = is just cosmetic not actually the problem. or the package name that is trying to be installed.

the problem is the version comparison. if the package is not installed it will install but say that it couldn't

right now the epoch added on the end is being included in the version comparison. and here is no clean way to remove it for the comparison. so when it goes to compare the versions the operating system will return 1.24.0-1.el7.ngx while we are trying to compare it to 1.24.0-1.el7.ngx.x86_64