Add repo removal logic#183
Open
l00d3r wants to merge 3 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR addresses issue #182 by improving repository management during repo/version changes, primarily by removing leftover version-suffixed repo files and standardizing repo file naming so upgrades don’t accumulate stale definitions.
Changes:
- Add cleanup steps on Debian and RedHat families to find and delete repo/key files matching a configurable regex before (re)creating repositories.
- Switch APT/YUM repository file naming to use a consistent, non-version-suffixed repo name (via a fact) and update Molecule tests accordingly.
- Introduce new defaults to control repo base name selection, cleanup regexes, and whether version-suffixed repo files should be removed.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
vars/main.yml |
Minor Jinja formatting cleanup for Debian arch mapping lookup. |
tasks/main.yml |
Adds facts (dnsdist_repo_name, dnsdist_repo_regex) used to control repo naming and cleanup matching. |
tasks/repo-Debian.yml |
Adds repo/key cleanup via find + file removal and updates deb822 repo naming to use the new fact. |
tasks/repo-RedHat.yml |
Adds repo cleanup via find + file removal and updates yum repo naming/file to use the new fact. |
defaults/main.yml |
Introduces new defaults controlling repo base name, regexes, and cleanup behavior. |
molecule/resources/tests/repo-master/test_repo_master.py |
Updates expected repo file path to the new non-version-suffixed naming. |
molecule/resources/tests/repo-21/test_repo_21.py |
Updates expected repo file path to the new non-version-suffixed naming. |
molecule/resources/tests/repo-20/test_repo_20.py |
Updates expected repo file path to the new non-version-suffixed naming. |
molecule/resources/tests/repo-19/test_repo_19.py |
Updates expected repo file path to the new non-version-suffixed naming. |
CHANGELOG.md |
Adds an unreleased entry documenting the repo naming/cleanup improvements. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
1
to
+14
| --- | ||
| - name: Find repo and key files using version suffixed sources and list files | ||
| ansible.builtin.find: | ||
| paths: | ||
| - /etc/apt/sources.list.d/ | ||
| - /etc/apt/trusted.gpg.d/ | ||
| - /etc/apt/keyrings/ | ||
| patterns: "{{ dnsdist_repo_regex }}" | ||
| use_regex: true | ||
| register: _dnsdist_version_suffixed_repo_files | ||
| tags: | ||
| - install | ||
| - repository | ||
|
|
Author
There was a problem hiding this comment.
ansible.builtin.find will not fail if a path does not exist, it emits a warning
Author
|
I implemented the sensible copilots suggestions, disregarded the misunderstandings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #182