Skip to content

Pr4/3 ;) add apt.sources_file operation#1597

Open
maisim wants to merge 3 commits intopyinfra-dev:3.xfrom
maisim:pr4-add-sources-file-operation
Open

Pr4/3 ;) add apt.sources_file operation#1597
maisim wants to merge 3 commits intopyinfra-dev:3.xfrom
maisim:pr4-add-sources-file-operation

Conversation

@maisim
Copy link
Copy Markdown
Contributor

@maisim maisim commented Mar 13, 2026

Creates /etc/apt/sources.list.d/.sources in modern deb822 format. Supports all standard fields (Types, URIs, Suites, Components, Architectures, Signed-By) and is idempotent via AptSources fact check.

Removal (present=False) deletes the file; removal on absent file is a noop.

Tests: create, create_idempotent, remove, remove_missing

  • 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 maisim changed the title Pr4 add sources file operation Pr4 add apt.sources_file operation Mar 13, 2026
@maisim
Copy link
Copy Markdown
Contributor Author

maisim commented Mar 13, 2026

@maisim maisim force-pushed the pr4-add-sources-file-operation branch from 88b17c3 to 2bf2273 Compare March 17, 2026 10:09
@maisim maisim changed the title Pr4 add apt.sources_file operation Pr4/3 ;) add apt.sources_file operation Mar 17, 2026
maisim added 3 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
Creates /etc/apt/sources.list.d/<filename>.sources in modern deb822
format. Supports all standard fields (Types, URIs, Suites, Components,
Architectures, Signed-By) and is idempotent via AptSources fact check.

Removal (present=False) deletes the file; removal on absent file is a noop.

Tests: create, create_idempotent, remove, remove_missing
@maisim maisim force-pushed the pr4-add-sources-file-operation branch from 2bf2273 to 4a5edee Compare April 26, 2026 12:30
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