pyinfra-dev / pyinfra-dev/pyinfra

Support retrieval of signing key in `apt.repo` operation (replace `apt.key`)

Open
#992 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

operations
Dominant language
Python
Stars
6k
Forks
548
Avg merge
7d 17h
Merged PRs (30d)
13

Description

Describe the bug

The apt.key operation invokes the Debian apt-key command[1], but that command is deprecated (see e.g. the apt-key man page).

The man page above says apt-key will be removed from versions of Ubuntu >= 22.04. This isn't actually true – as I can confirm apt-key in fact is available on Ubuntu 22.04 – but it might be helpful to users to add a deprecation warning in the docstring for the operation, similar to what the equivalent Ansible command does:

https://github.com/ansible/ansible/blob/c3926268e226da771943cbdb96f65fd343a980d5/lib/ansible/modules/apt_key.py#L30

[1]: here, and on the following lines:

https://github.com/Fizzadar/pyinfra/blob/6eca1a52d955a0497cd33c02cb9a94176f93583d/pyinfra/operations/apt.py#L78

To Reproduce

N.A.

Expected behavior

It would be helpful to users to add a deprecation warning in the documentation.

Comments

The recommended new approach is to download keys to somewhere like /usr/share/keyrings, and to use the signed-by option in /etc/apt/sources files (see e.g. "apt-key is deprecated", based on information from the Debian wiki). So it might be worth adding a link to pyinfra's GPG operation documentation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the apt.key operation docstring in pyinfra/operations/apt.py around the referenced lines. Compare the deprecation wording with Ansible's apt_key documentation and the linked GPG operation documentation; done means users are warned about apt-key and directed to the recommended keyring and signed-by approach.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops, documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.