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

Master port #50773: zypper's locks to holds #56935

Merged
merged 13 commits into from
Mar 1, 2021

Conversation

oeuftete
Copy link
Contributor

@oeuftete oeuftete commented Apr 28, 2020

Port of #50773.


What does this PR do?

Deprecates add_lock and remove_lock in favour of hold and unhold functions.

What issues does this PR fix or reference?

Fixes: #56922 (as part of making the original PR work)

Merge requirements satisfied?

  • Docs
  • Changelog
  • Tests written/updated*: There are no new tests, but moving the functionality here to hold/unhold activated a handful of package integration tests (which flushed out some bugs)

Commits signed with GPG?

No

@oeuftete oeuftete force-pushed the port-50773-to-master branch from a88e79a to 89cd23a Compare April 28, 2020 12:17
@oeuftete oeuftete added master-port Needs-Testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases labels Apr 28, 2020
@oeuftete
Copy link
Contributor Author

I wanted to get this master port up as part of addressing #56922 and customer support issues related to the hold/unhold functionality, which is already part of the SuSE-provided Salt packages. I can not currently take responsibility for writing the required test cases. @saltstack/team-suse, maybe?

@brejoc
Copy link
Contributor

brejoc commented Jul 1, 2020

I'm missing a bit of context here. Seems like #50773 was originally merged but then reverted again!? Was it incomplete?

@brejoc
Copy link
Contributor

brejoc commented Jul 1, 2020

Ah, sorry! I missed that that was develop for #50773. Okay, got it now.

@oeuftete oeuftete force-pushed the port-50773-to-master branch from 89cd23a to 6d18a78 Compare July 6, 2020 12:43
@ScriptAutomate
Copy link
Contributor

ScriptAutomate commented Aug 14, 2020

The functions being deprecated here should include something similar to the following at the top of their respective function docstrings:

.. deprecated:: 3002,3001.1
    This function is deprecated. Please use ``unhold()`` / ``hold()`` instead.

I opened a different issue related to how this guidance should be included in our Deprecating Code guidance: #58208

@oeuftete oeuftete force-pushed the port-50773-to-master branch 2 times, most recently from 36d10c0 to 85854cd Compare October 24, 2020 18:05
@oeuftete oeuftete marked this pull request as ready for review October 24, 2020 18:45
@oeuftete oeuftete requested a review from a team as a code owner October 24, 2020 18:45
@oeuftete oeuftete requested review from dwoz and removed request for a team October 24, 2020 18:45
@oeuftete oeuftete force-pushed the port-50773-to-master branch from 85854cd to 299c195 Compare October 24, 2020 20:32
@oeuftete oeuftete removed Needs-Testcase PR needs test cases written, or the issue is about a bug/feature that needs test cases has-failing-test labels Oct 31, 2020
@oeuftete oeuftete force-pushed the port-50773-to-master branch from 356be9b to 8abf515 Compare December 1, 2020 20:38
@ScriptAutomate
Copy link
Contributor

@oeuftete Can you resolve the conflicts in salt/modules/zypperpkg.py? I'd like to get this in front of some reviewers to see how close this is to getting merged.

for k in name_map:
u_name_map[k] = name_map[k]
return u_name_map
return get_repo_data(saltenv).get("name_map", {})
Copy link
Contributor

Choose a reason for hiding this comment

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

We still need to create a reverse map here. Should be:

    u_name_map = {}
    name_map = get_repo_data(saltenv).get("name_map", {})
    for k in name_map:
        u_name_map[k] = name_map[k]
    return u_name_map

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Even from my commit comment, I'm not 100% sure why I had to mess with this file four months ago (and then messed it up), but I believe it was to satisfy pre-commit requirements at the time. This file has no business being changed in this PR if it doesn't need to, so I'm going try to just rip the commit changing this out.

Interesting that no existing tests caught my mistake, this might be something to address.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it's meant to return the reverse map, I believe it was broken before...

-    u_name_map = {}
-    name_map = get_repo_data(saltenv).get("name_map", {})
-
-    if not six.PY2:
-        return name_map
-
-    for k in name_map:
-        u_name_map[k] = name_map[k]
-    return u_name_map
+    return get_repo_data(saltenv).get("name_map", {})

The reverse map would never be returned under py3. So that's why this was taken out when I de-sixed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@twangboy It looks like the original change is no longer required (the Windows tests pass), so I don't need to touch this module in this PR. If the lack of the reverse map is a bug, that should be addressed in a separate PR.

Copy link
Contributor Author

@oeuftete oeuftete left a comment

Choose a reason for hiding this comment

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

https://jenkins.saltproject.io/job/pr-opensuse15-py3-pytest/job/PR-56935/4/testReport/tests.integration.states.test_pkg/PkgTest/test_pkg_017_installed_held_equals_false/

tests.integration.states.test_pkg.PkgTest.test_pkg_017_installed_held_equals_false is now failing, which is related to the changes here.

E           AssertionError: 'held' not found in 'The following packages were installed/updated: lynx'

@oeuftete oeuftete marked this pull request as draft February 25, 2021 15:06
@oeuftete oeuftete force-pushed the port-50773-to-master branch from 3e15435 to 5e0397e Compare February 25, 2021 20:18
@oeuftete oeuftete marked this pull request as ready for review February 25, 2021 20:32
@oeuftete
Copy link
Contributor Author

Ready for review again. Thanks to @garethgreenaway for helping sort out the latest test failure.

@ScriptAutomate ScriptAutomate added the Aluminium Release Post Mg and Pre Si label Mar 1, 2021
@ScriptAutomate ScriptAutomate added this to the Aluminium milestone Mar 1, 2021
@OrangeDog
Copy link
Contributor

Why were these renamed in the first place? The other two lock functions (clean_locks and list_locks) were not renamed.

Zypper has no concept of "hold". It calls them package locks.

@oeuftete oeuftete deleted the port-50773-to-master branch August 26, 2022 23:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Aluminium Release Post Mg and Pre Si master-port
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] zypperpkg add_lock and remove_lock examples do not work
6 participants