Skip to content

feat(repositories): stop removing sources files and support unmanaged #80

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

didiermfb
Copy link
Contributor

@didiermfb didiermfb commented Apr 11, 2025

Based on sir-ragna's work on the PR #77
I think it's better to split the PR

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

Primary type

  • [build] Changes related to the build system
  • [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ci] Changes to the continuous integration configuration
  • [feat] A new feature
  • [fix] A bug fix
  • [perf] A code change that improves performance
  • [refactor] A code change that neither fixes a bug nor adds a feature
  • [revert] A change used to revert a previous commit
  • [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [docs] Documentation changes
  • [test] Adding missing or correcting existing tests

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

When setting apt:clean_sources_list_d=true files that are not required to be removed are not removed
A feature is added so that adding apt:repositories:repo:unmanaged=true allows you to specifically exclude a sources.list file from getting removed (or managed at all). This is handy in case another formula is managing this file.

Pillar / config required to test the proposed changes

Debug log showing how the proposed changes work

Documentation checklist

  • Updated the README (e.g. Available states).
  • Updated pillar.example.

Testing checklist

  • Included in Kitchen (i.e. under state_top).
  • Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • Updated the relevant test pillar.

Additional context

Added a Salt state to the tests to verify it isn't removed.

repos_maintained_by_another_formula:
  file.managed:
    - name: /etc/apt/sources.list.d/unmanaged.list
    - mode: '0644'
    - contents: "## unmanged list file that shouldn't be removed"

@didiermfb didiermfb force-pushed the feat/stop_remove_sources branch 2 times, most recently from 4ad1123 to 8404617 Compare April 11, 2025 08:43
@didiermfb didiermfb marked this pull request as ready for review April 11, 2025 08:54
@didiermfb didiermfb requested review from a team and javierbertoli as code owners April 11, 2025 08:54
@didiermfb didiermfb force-pushed the feat/stop_remove_sources branch from 8404617 to acbbd44 Compare April 14, 2025 09:02
@didiermfb
Copy link
Contributor Author

Rebased done.
Currently if the repo file is not updated, salt doesn't take care of the key. There is an open issue about it : saltstack/salt#66982
If you moved some of your lists to the new deb822 format and you want them to be unmanaged, you need to use the filename. Ex:

apt:
  repositories:
    deb822_repo:
      unmanaged: true
      filename: deb822_repo.sources

@didiermfb didiermfb force-pushed the feat/stop_remove_sources branch from acbbd44 to 6687a12 Compare April 14, 2025 09:59
Copy link
Member

@javierbertoli javierbertoli left a comment

Choose a reason for hiding this comment

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

It LGTM. Great work, @didiermfb !

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.

2 participants