Skip to content

Pr3/3 manage apt key removal#1487

Open
maisim wants to merge 2 commits intopyinfra-dev:3.xfrom
maisim:pr3-manage-apt-key-removal
Open

Pr3/3 manage apt key removal#1487
maisim wants to merge 2 commits intopyinfra-dev:3.xfrom
maisim:pr3-manage-apt-key-removal

Conversation

@maisim
Copy link
Copy Markdown
Contributor

@maisim maisim commented Oct 14, 2025

This pull request refactors and modernizes the APT repository and key management logic in src/pyinfra/facts/apt.py and related files. supporting both legacy and deb822 repository formats, and updating keyring handling to use modern GPG infrastructure.

Follow #1465

  • Pull request is based on the default branch (3.x at this time)
  • Pull request includes tests for any new/updated operations/facts
  • Pull request includes documentation for any new/updated operations/facts
  • Tests pass (see scripts/dev-test.sh)
  • Type checking & code style passes (see scripts/dev-lint.sh)

@maisim
Copy link
Copy Markdown
Contributor Author

maisim commented Oct 14, 2025

WIP, I messed up the rebase of this branch... I'll continue at the end of the week.

@maisim maisim force-pushed the pr3-manage-apt-key-removal branch from 2602657 to c9e83ad Compare October 16, 2025 09:05
@maisim maisim changed the title Pr3 manage apt key removal Pr3/3 manage apt key removal Oct 16, 2025
@maisim maisim force-pushed the pr3-manage-apt-key-removal branch from 74fe55e to 926fbfb Compare January 14, 2026 08:00
@maisim maisim marked this pull request as ready for review January 14, 2026 09:11
@maisim
Copy link
Copy Markdown
Contributor Author

maisim commented Jan 14, 2026

@DonDebonair @Fizzadar

Just did add, update, remove repos tests in real life test (on a bookworm VM). Operations and Facts worked has expected.

@maisim maisim marked this pull request as draft March 10, 2026 12:45
@maisim maisim force-pushed the pr3-manage-apt-key-removal branch from 926fbfb to 97a6ebc Compare March 13, 2026 08:43
@maisim
Copy link
Copy Markdown
Contributor Author

maisim commented Mar 13, 2026

@maisim maisim marked this pull request as ready for review March 17, 2026 08:08
@maisim maisim force-pushed the pr3-manage-apt-key-removal branch from 97a6ebc to 88b85a8 Compare March 17, 2026 10:09
maisim added 2 commits April 26, 2026 12:26
…mand

- Update AptKeys fact to use GpgKeyrings instead of deprecated apt-key command
- Maintain backward compatibility by flattening keyring data to match old format
- Search APT-specific directories: /etc/apt/trusted.gpg.d, /etc/apt/keyrings, /usr/share/keyrings
- Add comprehensive test coverage for modernized apt.key operations
- Support both legacy and modern APT key management workflows
- Rename _sanitize_apt_keyring_name → _sanitize_keyring_part (cleaner name)
- Remove dead 'dest' param from _derive_dest_from_src_and_keyids
- Expose APT_KEYRING_DIRS constant at module level
- Convert apt.key docstring to pyinfra '+' format
- Fix present=False + keyid without dest: delegate directly to
  gpg.key._inner(working_dirs=APT_KEYRING_DIRS) instead of resolving a
  wrong default dest
- Fix AptKeys.command() signature: directories=None with APT defaults as
  fallback, keeping LSP-compatible interface
- Add collision comment in AptKeys.process() (last keyring wins on same ID)
- Remove dead apt.AptKeys/gpg.GpgKey facts from test fixtures (apt.key
  delegates to gpg.key._inner, never calls those facts directly)
- Fix _tempfile_ path placeholder in keyserver fixtures
- Rewrite add_exists/add_keyserver_exists as true idempotent fixtures
  (file/keys already present → commands: [])
- Delete add_no_gpg and add_keyserver_multiple_partial (untestable or
  superseded)
- Add remove_file, remove_file_missing, remove_by_keyid fixtures
@maisim maisim force-pushed the pr3-manage-apt-key-removal branch from 88b85a8 to 4777b9c Compare April 26, 2026 12:27
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.

1 participant