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] [3006.1] pkgrepo.absent fails in 2 specific cases for apt-based distros #64286

Closed
1 of 9 tasks
terminalmage opened this issue May 16, 2023 · 1 comment
Closed
1 of 9 tasks
Assignees
Labels
Bug broken, incorrect, or confusing behavior needs-triage

Comments

@terminalmage
Copy link
Contributor

terminalmage commented May 16, 2023

Description

  1. Trailing slashes in the repo URI. This is because the pkgrepo states strip the trailing slash from apt repos (a fix added semi-recently to resolve bugs in pkgrepo.managed), but pkg.get_repo and pkg.del_repo (from aptpkg.py) do not normalize for trailing slashes.
  2. An architecture is present in the repo definition, but the existing repo matching the URI either does not contain an architecture, or contains a different architecture. This is because pkg.get_repo does not consider architecture when matching a repo definition (causing it to be identified as a match erroneously), and then pkg.del_repo (which does consider architecture) does not find a match and fails to delete, causing a CommandExecutionError to be raised.

Setup

/etc/apt/sources.list.d/google-chrome.list

deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

/srv/salt/test/init.sls

include:
  - .remove
  - .add

/srv/salt/test/remove.sls

chrome-repo-remove:
  pkgrepo.absent:
    - name: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main

/srv/salt/test/add.sls

chrome-repo-add:
  pkgrepo.managed:
    - name: deb http://dl.google.com/linux/chrome/deb stable main
    - dist: stable
    - file: /etc/apt/sources.list.d/added-chrome-repo.list
    - key_url: https://dl-ssl.google.com/linux/linux_signing_key.pub

Running a state.apply test with this configuration will fail on 3006.1 (bug number 1 above). You can get the removal to work if you edit the repo file in /etc/apt/sources.list.d/ and remove the trailing slash, but a second run will fail because the repo added in add.sls will incorrectly be identified as a match for the pkgrepo.absent state (bug number 2 above).

  • on-prem machine
  • VM (Virtualbox, KVM, etc. please specify)
  • VM running on a cloud service, please be explicit and add details
  • container (Kubernetes, Docker, containerd, etc. please specify)
  • or a combination, please be explicit
  • jails if it is FreeBSD
  • classic packaging
  • onedir packaging
  • used bootstrap to install

Steps to Reproduce the behavior
(Include debug logs if possible and relevant)

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Versions Report

salt --versions-report (Provided by running salt --versions-report. Please also mention any differences in master/minion versions.)
PASTE HERE

Additional context
Add any other context about the problem here.

@terminalmage terminalmage added Bug broken, incorrect, or confusing behavior needs-triage labels May 16, 2023
@terminalmage terminalmage changed the title [BUG] [3006.1] pkgrepo.absent fails in 2 specific cases [BUG] [3006.1] pkgrepo.absent fails in 2 specific cases for apt-based distros May 16, 2023
@terminalmage terminalmage self-assigned this May 16, 2023
@Ch3LL
Copy link
Contributor

Ch3LL commented Sep 11, 2023

Fixed by #64995

@Ch3LL Ch3LL closed this as completed Sep 11, 2023
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

Successfully merging a pull request may close this issue.

2 participants