I'm running automated tests the involve refreshing a VM setup using the released ubuntu-core-16 image with candidate snaps. I install core and reboot first, since otherwise attempting to refresh a snap with no changes exits with an error. After the reboot, auto-refresh starts. When the test script attempts to refresh the kernel snap, we get an error:
nuclearbob@localhost:~$ sudo snap changes ID Status Spawn Ready Summary 3 Error 2017-02-16T18:05:19Z 2017-02-16T18:05:49Z Refresh all snaps in the system 4 Done 2017-03-22T17:00:19Z 2017-03-22T17:00:37Z Refresh "core" snap from "candidate" channel 5 Doing 2017-03-22T17:01:34Z - Auto-refresh snap "pc-kernel" 6 Done 2017-03-22T17:01:37Z 2017-03-22T17:01:37Z Refresh "pc" snap from "candidate" channel nuclearbob@localhost:~$ sudo snap refresh --candidate pc-kernel error: cannot refresh "pc-kernel": snap "pc-kernel" has changes in progress nuclearbob@localhost:~$ echo $? 1 This causes the test runner script to exit, as the refresh fails. However, if I wait a bit, the auto-refresh seems to fail as well, and then if I retry the manual refresh, it succeeds: nuclearbob@localhost:~$ sudo snap changes ID Status Spawn Ready Summary 3 Error 2017-02-16T18:05:19Z 2017-02-16T18:05:49Z Refresh all snaps in the system 4 Done 2017-03-22T17:00:19Z 2017-03-22T17:00:37Z Refresh "core" snap from "candidate" channel 5 Error 2017-03-22T17:01:34Z 2017-03-22T17:03:04Z Auto-refresh snap "pc-kernel" 6 Done 2017-03-22T17:01:37Z 2017-03-22T17:01:37Z Refresh "pc" snap from "candidate" channel nuclearbob@localhost:~$ sudo snap refresh --candidate pc-kernel [/] Setup snap "pc-kernel" (59) security profiles Broadcast message from [email protected] (Wed 2017-03-22 17:04:02 UTC): reboot scheduled to update the system - temporarily cancel with 'sudo shutdown -c' The system is going down for reboot at Wed 2017-03-22 17:14:02 UTC! pc-kernel (candidate) 4.4.0-67.88 from 'canonical' refreshed Is the best way to handle this just grepping the output of snap changes for "Doing" and "pc-kernel" until there's nothing listed for that, and then retrying the refresh in case it failed before? Is there a better programmatic way to interact with the API? Thanks, Max -- Snapcraft mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft
