snapcraft list-keys with no snap keys returns an empty table

Bug #1736864 reported by Leo Arias
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
New
Undecided
Unassigned

Bug Description

This is similar to https://bugs.launchpad.net/snapcraft/+bug/1720210

My account, according to the store has 5 keys. ( This is are the keys returned by store.get_account_information()['account_keys'] ). However, when I run snap keys, it returns no keys:

$ snap keys --json
[]

In this scenario, when I run snapcraft keys, I get an empty table:

$ snapcraft keys
    Name SHA3-384 fingerprint

Instead of reporting an empty table, it should return a nice message saying that no keys are registered. Maybe explaining how to register one.

Revision history for this message
Sangbum Kim (sangbum) wrote :

Hi! This looks like a problem on line 244 (my fix for 1720210) which checks enabled_keys is empty or not.

Instead, it should check the list keys is empty or not.

Revision history for this message
Sangbum Kim (sangbum) wrote :

Ah, ignore #1. Maybe the scenario can be classified like this:

1. There are no keys on the machine: running 'snap keys' returns no keys (this case)
2. There are no keys registered on the store (fixed in https://bugs.launchpad.net/snapcraft/+bug/1720210)
3. Otherwise (list the keys as table)

So a nice message for case 1 is needed, right?

Revision history for this message
Sangbum Kim (sangbum) wrote :

Also, when tabulating the keys,
wouldn't it be good to show keys that are registered but not on the machine as '(not usable)' on the table? Currently, only the keys on the machine are displayed on the table.

Revision history for this message
Leo Arias (elopio) wrote :

sangbum: your comments sound correct to me, but I would like to get this triaged by somebody who knows more about keys than me.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.