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] pkgrepo.managed for apt shows a change every highstate #61923

Closed
feld opened this issue Apr 6, 2022 · 5 comments
Closed

[BUG] pkgrepo.managed for apt shows a change every highstate #61923

feld opened this issue Apr 6, 2022 · 5 comments
Labels
Bug broken, incorrect, or confusing behavior debian affects this operating system Duplicate Duplicate of another issue or PR - will be closed package-repo severity-low 4th level, cosemtic problems, work around exists
Milestone

Comments

@feld
Copy link
Contributor

feld commented Apr 6, 2022

Description
pkgrepo.managed shows a change every highstate because of salt.utils.pkg.deb.strip_uri

Setup
Try setting up a Debian package repo. Let's use this one directly from the docs 😉: https://docs.saltproject.io/en/latest/ref/states/all/salt.states.pkgrepo.html

image

Steps to Reproduce the behavior
Now every highstate shows a change:

----------
          ID: test_repo
    Function: pkgrepo.managed
        Name: deb http://dl.google.com/linux/chrome/deb/ stable main
      Result: True
     Comment: Configured package repo 'deb http://dl.google.com/linux/chrome/deb/ stable main'
     Started: 12:35:28.445649
    Duration: 6575.362 ms
     Changes:
              ----------
              repo:
                  deb http://dl.google.com/linux/chrome/deb stable main

Expected behavior
It doesn't show changes when there are none.

This happens because the URL http://dl.google.com/linux/chrome/deb/ ends with a / and this is stripped before being written to disk, but Salt is comparing the with the unmodified version.

@feld feld added Bug broken, incorrect, or confusing behavior needs-triage labels Apr 6, 2022
@welcome
Copy link

welcome bot commented Apr 6, 2022

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 [email protected]. We’re glad you’ve joined our community and look forward to doing awesome things with you!

@OrangeDog
Copy link
Contributor

The apt implementation is pretty broken, and I still don't understand why it was written like that.

You have to have the name be the line (mostly - bad design) exactly as it appears in the resulting sources.list.

Note also that the state currently uses the deprecated apt-key (#59408), so you're better off using file.managed anyway.

@OrangeDog OrangeDog added severity-low 4th level, cosemtic problems, work around exists debian affects this operating system package-repo and removed needs-triage labels Apr 7, 2022
@OrangeDog OrangeDog added this to the Approved milestone Apr 7, 2022
@hatifnatt
Copy link

Duplicate #60907

@feld
Copy link
Contributor Author

feld commented Apr 25, 2022

Note also that the state currently uses the deprecated apt-key (#59408), so you're better off using file.managed anyway.

Ok can we just remove pkgrepo.managed from Salt then??? Why is it even there if it's known to be unreliable?

@OrangeDog
Copy link
Contributor

OrangeDog commented Apr 25, 2022

@feld Because there are systems that aren't Debian, and it's better to fix it than to break it for everyone else.

@OrangeDog OrangeDog added the Duplicate Duplicate of another issue or PR - will be closed label Apr 25, 2022
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 debian affects this operating system Duplicate Duplicate of another issue or PR - will be closed package-repo severity-low 4th level, cosemtic problems, work around exists
Projects
None yet
Development

No branches or pull requests

3 participants