-
Notifications
You must be signed in to change notification settings - Fork 1.7k
add key does not report the new key's ID #4656
Description
Output of restic version
restic 0.16.3 compiled with go1.21.6 on linux/amd64
What backend/service did you use to store the repository?
rest:http://
Problem description / Steps to reproduce
When adding a key to a repository, we currently have no "easy" way to know the new key's ID.
This is a problem because sometimes we need to pass this ID as a hint for other commands.
In particular, a key hint is needed when the repository has many keys - otherwise opening the repository may fail with "Fatal: maximum number of keys reached" even when a proper password is provided.
Expected behavior
I suppose the author of the "key add" command wanted to have the ID printed like this:
saved new key as 116b1f6aaf7a299f6355bd7d892e2602e1a91f5b9ce8a69c6938ba3e4f1fcc79
Actual behavior
Currently key add displays instead:
restic -r /tmp/kevo/ key add
enter password for repository:
repository 70789ef8 opened (version 2, compression level auto)
enter new password:
enter password again:
saved new key as <Key of xx@yyy, created on 2024-01-25 10:17:55.560224177 +0100 CET m=+10.381054308>Do you have any idea what may have caused this?
The command dumps the Go object instead of the ID.
A trivial 1 line patch will be provided.
Did restic help you today? Did it make you happy in any way?
One day someone will outsmart all our defenses, burn our IT to the ground and destroy our other backups. Then the restic repos on the hard drives on the shelf it will save the day.