Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] pkg.installed state with pkgs argument but no version gives WARNING #64563

Closed
bdrx312 opened this issue Jun 28, 2023 · 3 comments · Fixed by #66388
Closed

[BUG] pkg.installed state with pkgs argument but no version gives WARNING #64563

bdrx312 opened this issue Jun 28, 2023 · 3 comments · Fixed by #66388
Labels
Bug broken, incorrect, or confusing behavior Regression The issue is a bug that breaks functionality known to work in previous releases. RHEL Related to running salt on or targeting Red Had Enterprise Linux

Comments

@bdrx312
Copy link
Contributor

bdrx312 commented Jun 28, 2023

Description

For some of my pkg.installed states I get this warning

[INFO ] Executing state pkg.installed for [install haproxy package]

[WARNING ] 'version' argument will be ignored for multiple package targets

I am not specifying a 'version' argument though.

My state looks like this:

"install haproxy package":
  pkg.installed:
    - pkgs:
      - haproxy

See https://devops.stackexchange.com/questions/18023/in-salt-what-causes-the-warning-version-argument-will-be-ignored-for-multiple

The code in lines 1450-1451 in yumpkg.py (https://github.com/saltstack/salt/blame/0892d076846525e694f8aedb6217884ca75845f3/salt/modules/yumpkg.py#L1450-L1451) converts the version argument to a str, but it converts even if the version argument is None which then converts the version argument to the literal string 'None'. This code needs to check that the value is not None before converting to a string.

Setup

Steps to Reproduce the behavior

"install haproxy package":
  pkg.installed:
    - pkgs:
      - haproxy

Expected behavior
No warning is display when using pkgs and not specifying a version

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

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
Master:
Salt Version:
          Salt: 3006.1
 
Python Version:
        Python: 3.9 (main, May 24 2023, 00:00:00) [GCC 13.1.1 20230511 (Red Hat 13.1.1-2)]

Additional context
Add any other context about the problem here.

@s0undt3ch
Copy link
Member

Same root cause as #64476

@s0undt3ch s0undt3ch added Regression The issue is a bug that breaks functionality known to work in previous releases. Sulfur v3006.2 and removed needs-triage labels Jun 28, 2023
@OrangeDog OrangeDog added RHEL Related to running salt on or targeting Red Had Enterprise Linux and removed Sulfur v3006.2 labels Jun 28, 2023
@bdrx312
Copy link
Contributor Author

bdrx312 commented Sep 8, 2023

I believe changing https://github.com/saltstack/salt/blame/5d86ead778983fd87e074a2093abe002e244aab8/salt/modules/yumpkg.py#L1456-L1457
to

    version = kwargs.get("version")
    if version is not None:
        kwargs["version"] = str(version)

would fix the issue; a quick simple 2 line change. I will try to find time at some point to figure out how setup, test and contribute pull requests, but in the meantime it would be nice if someone with a saltstack contributor development environment already setup could make this change for the next release.

@bwdbethke
Copy link

FYI, still seeing this warning a lot in v3006.7

Salt Version:
          Salt: 3006.7

Python Version:
        Python: 3.10.13 (main, Feb 19 2024, 03:31:20) [GCC 11.2.0]

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.3
       libgit2: Not Installed
  looseversion: 1.0.2
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     packaging: 22.0
     pycparser: 2.21
      pycrypto: Not Installed
  pycryptodome: 3.19.1
        pygit2: Not Installed
  python-gnupg: 0.4.8
        PyYAML: 6.0.1
         PyZMQ: 23.2.0
        relenv: 0.15.1
         smmap: Not Installed
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: amzn 2023
        locale: utf-8
       machine: x86_64
       release: 6.1.61-85.141.amzn2023.x86_64
        system: Linux
       version: Amazon Linux 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Regression The issue is a bug that breaks functionality known to work in previous releases. RHEL Related to running salt on or targeting Red Had Enterprise Linux
Projects
None yet
7 participants