cli: add KeyAlreadyExists error
Metadata
Current evaluation
Merged to release/7.1. Introduces a KeyAlreadyExists error for snapcraft create-key when generating an existing key, plus unit tests. Approved and passed CI.
Suggested action: —
No scores available.
Issue body
- [X] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [X] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [X] Have you successfully run `make lint`?
- [X] Have you successfully run `pytest tests/unit`?
-----
#### Overview
Raise new `KeyAlreadyExists` error when `snapcraft create-key` attempts to create an existing key.
#### Changes
1. Add new error `KeyAlreadyExists`
2. Add unit tests for some other `storeapi` errors.
#### Source
- https://bugs.launchpad.net/snapcraft/+bug/1979907
(CRAFT-1161)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged to release/7.1. Introduces a KeyAlreadyExists error for snapcraft create-key when generating an existing key, plus unit tests. Approved and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged after retargeting to the release/7.1 branch. Introduces a KeyAlreadyExists error to prevent duplicate key creation in snapcraft create-key, with corresponding unit tests. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Introduces a KeyAlreadyExists error to the CLI for snapcraft create-key when attempting to generate a duplicate key. Retargeted to release/7.1 per reviewer request. Includes unit tests. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #824 Add `snapcraft create-key` | snapcraft | merged | Merged. Adds snapcraft create-key to wrap snap create-key, unifying key creation and registration. Prevents duplicate registration errors and improves UX. Applied reviewer feedback and minor tweaks before merging. |