瀏覽代碼

Fix jobs-related bug in task conversion

While working on some other code, noticed a bug in the jobs code. We're
adding job version after we're checking if there are port configs.
Before, if there were no port configs, the job version would be missing,
because we would return before trying to convert.

This moves the jobs version conversion above that code, so we don't
accidentally return before it.

Signed-off-by: Drew Erny <derny@mirantis.com>
Drew Erny 4 年之前
父節點
當前提交
dd752ec87a
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      daemon/cluster/convert/task.go

+ 6 - 6
daemon/cluster/convert/task.go

@@ -51,6 +51,12 @@ func TaskFromGRPC(t swarmapi.Task) (types.Task, error) {
 		task.NetworksAttachments = append(task.NetworksAttachments, networkAttachmentFromGRPC(na))
 		task.NetworksAttachments = append(task.NetworksAttachments, networkAttachmentFromGRPC(na))
 	}
 	}
 
 
+	if t.JobIteration != nil {
+		task.JobIteration = &types.Version{
+			Index: t.JobIteration.Index,
+		}
+	}
+
 	if t.Status.PortStatus == nil {
 	if t.Status.PortStatus == nil {
 		return task, nil
 		return task, nil
 	}
 	}
@@ -65,11 +71,5 @@ func TaskFromGRPC(t swarmapi.Task) (types.Task, error) {
 		})
 		})
 	}
 	}
 
 
-	if t.JobIteration != nil {
-		task.JobIteration = &types.Version{
-			Index: t.JobIteration.Index,
-		}
-	}
-
 	return task, nil
 	return task, nil
 }
 }