Cancelling a remote update while it downloads

Until now an update posted to a device could only be cancelled from Pantacor Hub while the step was still NEW. Once the device had picked the revision up, the Hub refused the cancel, and the device never looked at its own step again anyway. A long download could not be stopped from the cloud. That is fixed across the Hub, Pantavisor and pvr.

What changed

Pantacor Hub

  • PUT /trails/{id}/steps/{rev}/cancel is now accepted while the step is NEW, QUEUED, DOWNLOADING or INPROGRESS.
  • Session tokens (pvr, OAuth) are accepted on this endpoint. The old check answered 403 to them.
  • The owner wontgo action and the WONTGO state stay supported. They are the only exit from a retry loop for devices running older Pantavisor releases. They are marked deprecated in the API docs.

Pantavisor

  • While a revision is QUEUED or DOWNLOADING, the device polls its own step every ~6 seconds.
  • On CANCEL it aborts the object and metadata requests in flight, reports CANCEL with the message “Cancelled as requested by owner”, and returns to idle on the previous revision. The bootloader is never touched, so CANCEL is a final state but not a failed one.
  • Partial objects already on disk are kept, so a later re-post of the same revision does not have to re-download what already arrived once the HTTP Range resume work lands.
  • After INPROGRESS the device no longer looks for a cancel. Stopping midway once the bootloader may be written is not safe. A cancel set at that point only keeps a device that lost track of the step from fetching and retrying it, which is what wontgo did.

pvr

  • New subcommand pvr device steps cancel, the owner-side counterpart. It prints the resulting step progress.

How to use it

pvr device steps cancel <DEVICE_ID> --rev=4
pvr device steps cancel https://pvr.pantahub.com/<USER>/<NICK>/4

Or against the API directly:

curl -X PUT \
  -H "Authorization: Bearer <TOKEN>" \
  https://api.pantahub.com/trails/<DEVICE_ID>/steps/<REV>/cancel

One caveat. The device sends its progress report right after each step poll. A cancel that lands in that short window is overwritten by the report. If the step still shows DOWNLOADING a few seconds after you cancelled, issue the cancel again.

How to get it

  • The Hub side is live on api.pantahub.com.
  • Pantavisor: on master now (pantavisor#810), in the next release.
  • pvr: pvr device steps cancel is on master (merge request 502), in the next release. Until then, use the API call above.