Setting a default track to a track that does not exist returns an undocumented 400

Bug #1892553 reported by Sergio Schvezov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snap Store Server
New
Undecided
Unassigned
Snapcraft
Fix Released
Low
Sergio Schvezov

Bug Description

Hello,

I am in the process of implementing being able to set a default track from snapcraft, while testing against staging I ran into the following:

ubuntu@snapcraft-dev:~/snapcraft$ snapcraft tracks candycane
Name Status Creation-Date Version-Pattern
latest active - -
candybar default 2019-10-17T14:11:59Z -
x active 2020-08-21T20:30:00Z x\..*
ubuntu@snapcraft-dev:~/snapcraft$ snapcraft set-default-track candycane x
Default track for 'candycane' set to 'x'.
ubuntu@snapcraft-dev:~/snapcraft$ snapcraft set-default-track candycane foo
Received 400: 'Select a valid choice. The given value is not one of the available choices.'
ubuntu@snapcraft-dev:~/snapcraft$ snapcraft set-default-track candycane latest
Received 400: 'Select a valid choice. The given value is not one of the available choices.'

Describing,

- setting to a valid user created (on behalf of the Snap Store admin) track works just as expected
- setting to a non existent track returns a 400, this is not documented on https://dashboard.snapcraft.io/docs/api/snap.html#managing-snap-metadata and I wonder if this should be a 404. It also returns a strange message
- trying to set to latest returns a 400 as well. The latest agreement is that this operation should be possible.

The important bit is to know what the actual error code to commit to is to correctly capture and return a nicer Snapcraft message to the user.

Thanks

summary: - Setting a default track to a track that does not exist returns a 400 and
- a standard django message
+ Setting a default track to a track that does not exist returns an
+ undocumented 400
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

We solved the error handling client side (Snapcraft) with a channel map query to the Snap Store before trying to set the track. What is missing from the Snap Store is being able to set "latest" as the default.

Changed in snapcraft:
status: New → Fix Released
importance: Undecided → Low
assignee: nobody → Sergio Schvezov (sergiusens)
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.