snapcraft close should complain early with one argument

Bug #1735800 reported by Adam Collard
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Confirmed
Undecided
Unassigned

Bug Description

I find myself accidentally omitting the snap name quite often with snapcraft and didn't notice my mistake when attempting to close a branch using:

⟫ snapcraft close edge/bump-20
Your account lacks permission to close channels for this snap. Make sure the logged in account has upload permissions on 'edge/bump-20' in series '16'.

snapcraft knows that 'close' needs at least two arguments and additionally it should know that '/' is not a valid character for a snap name. By applying this knowledge, snapcraft could help me realise my typo.

Bonus points if it inspects the current directory for a snapcraft.yaml and suggests the right command to me.

Revision history for this message
Daniel Manrique (roadmr) wrote :

This has happened to users in the wild:

https://forum.snapcraft.io/t/unable-to-close-channel-in-a-track/7063/4

https://forum.snapcraft.io/t/firefox-please-create-the-track-esr/5006/22

Other than Adam's suggestion, perhaps the error message template can be changed to clearly indicate it's talking about the *snap* name, not the channel.

diff --git a/snapcraft/storeapi/errors.py b/snapcraft/storeapi/errors.py
index 709b204a..25ef0b9f 100644
--- a/snapcraft/storeapi/errors.py
+++ b/snapcraft/storeapi/errors.py
@@ -598,8 +598,8 @@ class StoreChannelClosingPermissionError(StoreError):

     fmt = (
         'Your account lacks permission to close channels for this snap. Make '
- 'sure the logged in account has upload permissions on {snap_name!r} '
- 'in series {snap_series!r}.'
+ 'sure the logged in account has upload permissions on the '
+ '{snap_name!r} snap in series {snap_series!r}.'
     )

     def __init__(self, snap_name, snap_series):

Changed in snapcraft:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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