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

Handle packages with multiple versions properly with zypper #48294

Merged

Conversation

meaksh
Copy link
Contributor

@meaksh meaksh commented Jun 25, 2018

What does this PR do?

This PR fixes some issues introduced after merging #47678 .

What issues does this PR fix or reference?

  • Exclude gpg-pubkey entries from zypper.list_pkg
  • Fix changes on pkg.installed output when dealing with packages with multiple versions installed.
  • Fix changes on pkg.installed output when packages name include "arch".

Previous Behavior

On a SUSE systems, given this SLS state file:

my_tests:
  pkg.installed:
    - pkgs:
      - kernel-default.x86_64: 4.4.138-94.39.1
      - iotop.noarch: 0.6-3.10
      - apache2.x86_64: 2.4.23-29.18.2
      - apache2-doc: 2.4.23-29.18.2
      - perseus-dummy.i586: 1.1-1.1
      - orion-dummy: 1.1-1.1

Applying my_tests state will produce:

local:
----------
          ID: my_tests
    Function: pkg.installed
      Result: True
     Comment: 6 targeted packages were installed/updated.
     Started: 16:05:56.124001
    Duration: 24153.705 ms
     Changes:   
              ----------
              apache2:
                  ----------
                  new:
                      2.4.23-29.18.2
                  old:
              apache2-doc:
                  ----------
                  new:
                      2.4.23-29.18.2
                  old:
              apache2-prefork:
                  ----------
                  new:
                      2.4.23-29.18.2
                  old:
              gpg-pubkey:
                  ----------
                  new:
                      e6e5a213-5b291a5f
                  old:
                      39db7c82-5847eb1f,8a7c64f9-5aaa93ca,e6e5a213-5b291a5f
              iotop:
                  ----------
                  new:
                      0.6-3.10
                  old:
              orion-dummy:
                  ----------
                  new:
                      1.1-1.1
                  old:

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:  24.154 s

Notice that perseus-dummy.x586 package, as well as kernel-default, are actually installed but not reported on changes (and they should). Also the non-desired gpg-pubkey entry is not excluded from changes since it's not actually a real package.

New Behavior

Given the same SLS file:

local:
----------
          ID: my_tests
    Function: pkg.installed
      Result: True
     Comment: 6 targeted packages were installed/updated.
     Started: 16:14:13.955445
    Duration: 24761.717 ms
     Changes:   
              ----------
              apache2:
                  ----------
                  new:
                      2.4.23-29.18.2
                  old:
              apache2-doc:
                  ----------
                  new:
                      2.4.23-29.18.2
                  old:
              apache2-prefork:
                  ----------
                  new:
                      2.4.23-29.18.2
                  old:
              iotop:
                  ----------
                  new:
                      0.6-3.10
                  old:
              kernel-default:
                  ----------
                  new:
                      4.4.138-94.39.1,4.4.73-5.1
                  old:
                      4.4.73-5.1
              orion-dummy:
                  ----------
                  new:
                      1.1-1.1
                  old:
              perseus-dummy.i586:
                  ----------
                  new:
                      1.1-1.1
                  old:

Summary for local
------------
Succeeded: 1 (changed=1)
Failed:    0
------------
Total states run:     1
Total run time:  24.762 s

Now, both perseus-dummy.i586 and kernel-default are successfully reported on changes, and the gpg-pubkey entry is excluded.

Tests written?

Yes

Commits signed with GPG?

Yes

@ghost ghost self-requested a review June 25, 2018 14:21
Copy link
Contributor

@isbm isbm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests?

@meaksh
Copy link
Contributor Author

meaksh commented Jun 25, 2018

@isbm - Right, currently working on them. I'll ping you back when I uploaded them.

@meaksh meaksh force-pushed the develop-zypper-multiversion-fixes branch from a8f6a1c to d68ffec Compare June 26, 2018 08:49
@meaksh meaksh force-pushed the develop-zypper-multiversion-fixes branch from d68ffec to 5d3a262 Compare June 26, 2018 08:50
@meaksh
Copy link
Contributor Author

meaksh commented Jun 26, 2018

@isbm - Tests are pushed now. This should be ready now for review. Thanks 👍

Copy link
Contributor

@isbm isbm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meaksh very nice! One little nitpick and good to go.

line,
osarch=__grains__['osarch']
)
if pkginfo is not None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if pkginfo:
    ...

Copy link
Contributor

@isbm isbm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meaksh thanks!

@rallytime rallytime merged commit 6ffc50e into saltstack:develop Jul 3, 2018
@meaksh meaksh deleted the develop-zypper-multiversion-fixes branch July 3, 2018 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants