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.list_pkgs(attr="all) (yum/zypper) calsl pkg_resource.format_pkg_list()` wrongly #62032

Closed
agraul opened this issue May 6, 2022 · 0 comments · Fixed by #62033
Closed
Assignees
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@agraul
Copy link
Contributor

agraul commented May 6, 2022

Description
pkg.list_pkgs(attr="all") turns "all" into ["all"] before passing it to pkg_resource.format_pkg_list(). The latter function expects either a list of attributes or the string "all". Upon encountering ["all"], it parses it as a list of attributes to include in its return value. As a result, only the default "version" and "arch" attributes are returned.

Setup

One minion with yum, e.g. AlmaLinux 8 and another with zypper (e.g. openSUSE Leap 15.3). Salt 3004 on the master and the minions.

Steps to Reproduce the behavior:

# salt '*'  pkg.list_pkgs attr=all
[...]
    zlib:
        |_
          ----------
          arch:
              x86_64
          version:
              1.2.11

Expected behavior:

# salt '*'  pkg.list_pkgs attr=all
[...]
    zypper:
        |_
          ----------
          arch:
              x86_64
          epoch:
              None
          install_date:
              2022-02-22T18:22:09Z
          install_date_time_t:
              1645554129
          release:
              24.1
          version:
              1.14.51

Versions Report

salt --versions-report The exact version does not matter, `zypperpkg.upgrade` does not know the parameter in any of them. I reproduced this on a setup using
Salt Version:
          Salt: 3002.2
 
Dependency Versions:
          cffi: 1.13.2
      cherrypy: unknown
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 2.10.1
       libgit2: 0.28.4
      M2Crypto: 0.35.2
          Mako: Not Installed
       msgpack: 0.5.6
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.17
      pycrypto: 3.9.0
  pycryptodome: Not Installed
        pygit2: 0.28.2
        Python: 3.6.13 (default, Mar 10 2021, 18:30:35) [GCC]
  python-gnupg: Not Installed
        PyYAML: 5.4.1
         PyZMQ: 17.0.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.2.3
 
System Versions:
          dist: sles 15.3 2021.05
        locale: UTF-8
       machine: x86_64
       release: 5.3.18-59.27-default
        system: Linux
       version: SLES 15.3 2021.05

Additional context
Add any other context about the problem here.

@agraul agraul added Bug broken, incorrect, or confusing behavior needs-triage labels May 6, 2022
@agraul agraul self-assigned this May 6, 2022
agraul added a commit to openSUSE/salt that referenced this issue Jun 14, 2022
pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
(cherry picked from commit 05482da89b91442235d3cc2889e59ac3722a7fae)
meaksh pushed a commit to openSUSE/salt that referenced this issue Jul 7, 2022
…ade()/yumpkg.upgrade() - backport 3004 (#538)

* Migrate zypper.upgrade tests to pytest

(cherry picked from commit ecce005b543f66198c7ac118966254dd3d60682f)

* Add names and pkgs parameters to zypper.upgrade

Fixes saltstack/salt#62030

(cherry picked from commit 19ebb40dc4538c983721a8746a201b7f1300c2f7)

* Don't turn attr="all" into a list

pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
(cherry picked from commit 05482da89b91442235d3cc2889e59ac3722a7fae)

* Add diff_attr parameter to zypper/yum upgrade

diff_attr works just like it does for pkg.install. Having the
option to return additional attributes can remove the need for a
follow-up list_pkgs call.

Fixes: saltstack/salt#62031
(cherry picked from commit 20ffffe3be6c7d94e9cc3338a57bbf5014f33d93)
agraul added a commit to agraul/salt that referenced this issue Oct 6, 2022
pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack#62032
Ch3LL pushed a commit that referenced this issue Oct 6, 2022
pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: #62032
meaksh pushed a commit to openSUSE/salt that referenced this issue Dec 28, 2022
…ade()/yumpkg.upgrade() - backport 3004 (#538)

* Migrate zypper.upgrade tests to pytest

(cherry picked from commit ecce005b543f66198c7ac118966254dd3d60682f)

* Add names and pkgs parameters to zypper.upgrade

Fixes saltstack/salt#62030

(cherry picked from commit 19ebb40dc4538c983721a8746a201b7f1300c2f7)

* Don't turn attr="all" into a list

pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
(cherry picked from commit 05482da89b91442235d3cc2889e59ac3722a7fae)

* Add diff_attr parameter to zypper/yum upgrade

diff_attr works just like it does for pkg.install. Having the
option to return additional attributes can remove the need for a
follow-up list_pkgs call.

Fixes: saltstack/salt#62031
(cherry picked from commit 20ffffe3be6c7d94e9cc3338a57bbf5014f33d93)
meaksh pushed a commit to openSUSE/salt that referenced this issue Dec 28, 2022
…ade()/yumpkg.upgrade() - backport 3004 (#538)

* Migrate zypper.upgrade tests to pytest

(cherry picked from commit ecce005b543f66198c7ac118966254dd3d60682f)

* Add names and pkgs parameters to zypper.upgrade

Fixes saltstack/salt#62030

(cherry picked from commit 19ebb40dc4538c983721a8746a201b7f1300c2f7)

* Don't turn attr="all" into a list

pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
(cherry picked from commit 05482da89b91442235d3cc2889e59ac3722a7fae)

* Add diff_attr parameter to zypper/yum upgrade

diff_attr works just like it does for pkg.install. Having the
option to return additional attributes can remove the need for a
follow-up list_pkgs call.

Fixes: saltstack/salt#62031
(cherry picked from commit 20ffffe3be6c7d94e9cc3338a57bbf5014f33d93)
meaksh pushed a commit to openSUSE/salt that referenced this issue Dec 29, 2022
…ade()/yumpkg.upgrade() - backport 3004 (#538)

* Migrate zypper.upgrade tests to pytest

(cherry picked from commit ecce005b543f66198c7ac118966254dd3d60682f)

* Add names and pkgs parameters to zypper.upgrade

Fixes saltstack/salt#62030

(cherry picked from commit 19ebb40dc4538c983721a8746a201b7f1300c2f7)

* Don't turn attr="all" into a list

pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
(cherry picked from commit 05482da89b91442235d3cc2889e59ac3722a7fae)

* Add diff_attr parameter to zypper/yum upgrade

diff_attr works just like it does for pkg.install. Having the
option to return additional attributes can remove the need for a
follow-up list_pkgs call.

Fixes: saltstack/salt#62031
(cherry picked from commit 20ffffe3be6c7d94e9cc3338a57bbf5014f33d93)
meaksh pushed a commit to openSUSE/salt that referenced this issue Dec 29, 2022
…ade()/yumpkg.upgrade() - backport 3004 (#538)

* Migrate zypper.upgrade tests to pytest

(cherry picked from commit ecce005b543f66198c7ac118966254dd3d60682f)

* Add names and pkgs parameters to zypper.upgrade

Fixes saltstack/salt#62030

(cherry picked from commit 19ebb40dc4538c983721a8746a201b7f1300c2f7)

* Don't turn attr="all" into a list

pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
(cherry picked from commit 05482da89b91442235d3cc2889e59ac3722a7fae)

* Add diff_attr parameter to zypper/yum upgrade

diff_attr works just like it does for pkg.install. Having the
option to return additional attributes can remove the need for a
follow-up list_pkgs call.

Fixes: saltstack/salt#62031
(cherry picked from commit 20ffffe3be6c7d94e9cc3338a57bbf5014f33d93)
meaksh pushed a commit to openSUSE/salt that referenced this issue Dec 29, 2022
…ade()/yumpkg.upgrade() - backport 3004 (#538)

* Migrate zypper.upgrade tests to pytest

(cherry picked from commit ecce005b543f66198c7ac118966254dd3d60682f)

* Add names and pkgs parameters to zypper.upgrade

Fixes saltstack/salt#62030

(cherry picked from commit 19ebb40dc4538c983721a8746a201b7f1300c2f7)

* Don't turn attr="all" into a list

pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
(cherry picked from commit 05482da89b91442235d3cc2889e59ac3722a7fae)

* Add diff_attr parameter to zypper/yum upgrade

diff_attr works just like it does for pkg.install. Having the
option to return additional attributes can remove the need for a
follow-up list_pkgs call.

Fixes: saltstack/salt#62031
(cherry picked from commit 20ffffe3be6c7d94e9cc3338a57bbf5014f33d93)
meaksh pushed a commit to openSUSE/salt that referenced this issue Dec 29, 2022
…ade()/yumpkg.upgrade() - backport 3004 (#538)

* Migrate zypper.upgrade tests to pytest

(cherry picked from commit ecce005b543f66198c7ac118966254dd3d60682f)

* Add names and pkgs parameters to zypper.upgrade

Fixes saltstack/salt#62030

(cherry picked from commit 19ebb40dc4538c983721a8746a201b7f1300c2f7)

* Don't turn attr="all" into a list

pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
(cherry picked from commit 05482da89b91442235d3cc2889e59ac3722a7fae)

* Add diff_attr parameter to zypper/yum upgrade

diff_attr works just like it does for pkg.install. Having the
option to return additional attributes can remove the need for a
follow-up list_pkgs call.

Fixes: saltstack/salt#62031
(cherry picked from commit 20ffffe3be6c7d94e9cc3338a57bbf5014f33d93)
blu-base pushed a commit to blu-base/saltext-zypper that referenced this issue Nov 2, 2024
pkg_resource.format_pkg_list expects its `attr` argument to be either a
list of attributes or the string "all" to indicate all available
attributes should be used for formatting.

Fixes: saltstack/salt#62032
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 needs-triage
Projects
None yet
1 participant