Ubuntu Pastebin

Paste from pedronis at Mon, 27 Nov 2017 17:35:18 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
diff --git a/overlord/snapstate/snapstate.go b/overlord/snapstate/snapstate.go
index 7019717..75427aa 100644
--- a/overlord/snapstate/snapstate.go
+++ b/overlord/snapstate/snapstate.go
@@ -61,6 +61,9 @@ func needsMaybeCore(typ snap.Type) int {
 }
 
 func doInstall(st *state.State, snapst *SnapState, snapsup *SnapSetup, flags int) (*state.TaskSet, error) {
+       if snapst.IsInstalled() && !snapst.Active {
+               return nil, fmt.Errorf("internal error: cannot update a disabled snap")
+       }
        if snapsup.Flags.Classic {
                if !release.OnClassic {
                        return nil, fmt.Errorf("classic confinement is only supported on classic systems")
@@ -129,7 +132,7 @@ func doInstall(st *state.State, snapst *SnapState, snapsup *SnapSetup, flags int
                prev = mount
        }
 
-       if snapst.Active {
+       if snapst.IsInstalled() {
                // unlink-current-snap (will stop services for copy-data)
                stop := st.NewTask("stop-snap-services", fmt.Sprintf(i18n.G("Stop snap %q services"), snapsup.Name()))
                addTask(stop)
Download as text