Skip to content

Add repo removal logic#183

Open
l00d3r wants to merge 3 commits into
PowerDNS:masterfrom
l00d3r:repo-cleanup
Open

Add repo removal logic#183
l00d3r wants to merge 3 commits into
PowerDNS:masterfrom
l00d3r:repo-cleanup

Conversation

@l00d3r

@l00d3r l00d3r commented Jun 1, 2026

Copy link
Copy Markdown

Fixes #182

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 thread tasks/main.yml
Comment thread defaults/main.yml
Comment thread tasks/repo-Debian.yml
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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

ansible.builtin.find will not fail if a path does not exist, it emits a warning

Comment thread tasks/repo-RedHat.yml Outdated
Comment thread tasks/repo-RedHat.yml Outdated
@l00d3r

l00d3r commented Jun 3, 2026

Copy link
Copy Markdown
Author

I implemented the sensible copilots suggestions, disregarded the misunderstandings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

clean up better on changes when new repo is installed

2 participants