Browse code

Merge pull request #30650 from aluzzardi/1.13.x-swarmkit-bump

[1.13.x] Re-vendor swarmkit to 1c7f003d75f091d5f7051ed982594420e4515f77

Victor Vieux authored on 2017/02/02 08:54:56
Showing 2 changed files
... ...
@@ -101,7 +101,7 @@ github.com/docker/containerd aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
101 101
 github.com/tonistiigi/fifo 1405643975692217d6720f8b54aeee1bf2cd5cf4
102 102
 
103 103
 # cluster
104
-github.com/docker/swarmkit 0af40501a9cc98cd3e9425d2e4246dd3eff5526e
104
+github.com/docker/swarmkit 1c7f003d75f091d5f7051ed982594420e4515f77
105 105
 github.com/golang/mock bd3c8e81be01eef76d4b503f5e687d2d1354d2d9
106 106
 github.com/gogo/protobuf v0.3
107 107
 github.com/cloudflare/cfssl 7fb22c8cba7ecaf98e4082d22d65800cf45e042a
... ...
@@ -104,17 +104,21 @@ func Resolve(ctx context.Context, task *api.Task, executor Executor) (Controller
104 104
 
105 105
 	// depending on the tasks state, a failed controller resolution has varying
106 106
 	// impact. The following expresses that impact.
107
-	if task.Status.State < api.TaskStateStarting {
108
-		if err != nil {
109
-			// before the task has been started, we consider it a rejection.
110
-			status.Message = "resolving controller failed"
111
-			status.Err = err.Error()
107
+	if err != nil {
108
+		status.Message = "resolving controller failed"
109
+		status.Err = err.Error()
110
+		// before the task has been started, we consider it a rejection.
111
+		// if task is running, consider the task has failed
112
+		// otherwise keep the existing state
113
+		if task.Status.State < api.TaskStateStarting {
112 114
 			status.State = api.TaskStateRejected
113
-		} else if task.Status.State < api.TaskStateAccepted {
114
-			// we always want to proceed to accepted when we resolve the contoller
115
-			status.Message = "accepted"
116
-			status.State = api.TaskStateAccepted
115
+		} else if task.Status.State <= api.TaskStateRunning {
116
+			status.State = api.TaskStateFailed
117 117
 		}
118
+	} else if task.Status.State < api.TaskStateAccepted {
119
+		// we always want to proceed to accepted when we resolve the controller
120
+		status.Message = "accepted"
121
+		status.State = api.TaskStateAccepted
118 122
 	}
119 123
 
120 124
 	return ctlr, status, err