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] aptpkg: Updating held packages via sources does not work #66459

Open
krombel opened this issue May 2, 2024 · 1 comment
Open

[BUG] aptpkg: Updating held packages via sources does not work #66459

krombel opened this issue May 2, 2024 · 1 comment
Assignees
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@krombel
Copy link

krombel commented May 2, 2024

Description
When installing packages via state pkg.installed by using the sources arg updating of held packages does not work.

Setup

common-pkgs:
  pkg.installed:
    - sources:
      - pkg1: salt://common/pkg1_{{ pkg1_version }}.deb
      - pkg2: salt://common/pkg2_{{ pkg2_version }}.deb
    - hold: True
    - update_holds: True

Steps to Reproduce the behavior

# salt-call state.apply common
local:
----------
          ID: common-pkgs
    Function: pkg.installed
      Result: False
     Comment: Problem encountered installing package(s). Additional info follows:
              
              errors:
                  - Running scope as unit: run-rc481e0a775024bad8e2077bd25caa6d3.scope
                    E: Held packages were changed and -y was used without --allow-change-held-packages.
     Started: 11:21:49.207895
    Duration: 12991.293 ms
     Changes:

Expected behavior
update would be working

Versions Report
3007.0

Additional context
In debug logs I see folloging line:

[DEBUG   ] Current version (['1.0.8922-1']) did not match desired version specification (salt://common/pkg1_1.0.9457-1.deb), adding to installation targets

It seems, that all_pkgs in aptpkg.py does contain the path an not the package name
=> pkg1 will not be added to the to_unhold array so it wont be "unholded" before the install is triggered.

I see 2 possible approaches to fix this:

  1. extend targeted_names with the keys of the sources dict so this package gets added to_unhold
  2. pass --allow-change-held-packages (introduced in 1.1 as successor for the --force-yes param) to apt - e.g. by using update_holds which is documented as working for apt, yum and zypper but seems to only be implemented for yum.

The second approach has the charme, that the implementation around to_unhold might be completely be skipped by making this param "responsible" for allowing updates.

@krombel krombel added Bug broken, incorrect, or confusing behavior needs-triage labels May 2, 2024
Copy link

welcome bot commented May 2, 2024

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!

@Akm0d Akm0d self-assigned this May 8, 2024
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
Development

No branches or pull requests

2 participants