Browse code

fix ID -> Id api

Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)

Victor Vieux authored on 2014/01/30 05:31:49
Showing 5 changed files
... ...
@@ -875,7 +875,7 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
875 875
 	}
876 876
 
877 877
 	for _, out := range outs.Data {
878
-		outID := out.Get("ID")
878
+		outID := out.Get("Id")
879 879
 		if !*quiet {
880 880
 			if *noTrunc {
881 881
 				fmt.Fprintf(w, "%s\t", outID)
... ...
@@ -1167,7 +1167,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
1167 1167
 			}
1168 1168
 
1169 1169
 			if filter != "" {
1170
-				if filter == image.Get("ID") || filter == utils.TruncateID(image.Get("ID")) {
1170
+				if filter == image.Get("Id") || filter == utils.TruncateID(image.Get("Id")) {
1171 1171
 					startImage = image
1172 1172
 				}
1173 1173
 
... ...
@@ -1225,7 +1225,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
1225 1225
 			for _, repotag := range out.GetList("RepoTags") {
1226 1226
 
1227 1227
 				repo, tag := utils.ParseRepositoryTag(repotag)
1228
-				outID := out.Get("ID")
1228
+				outID := out.Get("Id")
1229 1229
 				if !*noTrunc {
1230 1230
 					outID = utils.TruncateID(outID)
1231 1231
 				}
... ...
@@ -1251,12 +1251,12 @@ func (cli *DockerCli) WalkTree(noTrunc bool, images *engine.Table, byParent map[
1251 1251
 		for index, image := range images.Data {
1252 1252
 			if index+1 == length {
1253 1253
 				printNode(cli, noTrunc, image, prefix+"└─")
1254
-				if subimages, exists := byParent[image.Get("ID")]; exists {
1254
+				if subimages, exists := byParent[image.Get("Id")]; exists {
1255 1255
 					cli.WalkTree(noTrunc, subimages, byParent, prefix+"  ", printNode)
1256 1256
 				}
1257 1257
 			} else {
1258 1258
 				printNode(cli, noTrunc, image, prefix+"\u251C─")
1259
-				if subimages, exists := byParent[image.Get("ID")]; exists {
1259
+				if subimages, exists := byParent[image.Get("Id")]; exists {
1260 1260
 					cli.WalkTree(noTrunc, subimages, byParent, prefix+"\u2502 ", printNode)
1261 1261
 				}
1262 1262
 			}
... ...
@@ -1264,7 +1264,7 @@ func (cli *DockerCli) WalkTree(noTrunc bool, images *engine.Table, byParent map[
1264 1264
 	} else {
1265 1265
 		for _, image := range images.Data {
1266 1266
 			printNode(cli, noTrunc, image, prefix+"└─")
1267
-			if subimages, exists := byParent[image.Get("ID")]; exists {
1267
+			if subimages, exists := byParent[image.Get("Id")]; exists {
1268 1268
 				cli.WalkTree(noTrunc, subimages, byParent, prefix+"  ", printNode)
1269 1269
 			}
1270 1270
 		}
... ...
@@ -1277,10 +1277,10 @@ func (cli *DockerCli) printVizNode(noTrunc bool, image *engine.Env, prefix strin
1277 1277
 		parentID string
1278 1278
 	)
1279 1279
 	if noTrunc {
1280
-		imageID = image.Get("ID")
1280
+		imageID = image.Get("Id")
1281 1281
 		parentID = image.Get("ParentId")
1282 1282
 	} else {
1283
-		imageID = utils.TruncateID(image.Get("ID"))
1283
+		imageID = utils.TruncateID(image.Get("Id"))
1284 1284
 		parentID = utils.TruncateID(image.Get("ParentId"))
1285 1285
 	}
1286 1286
 	if parentID == "" {
... ...
@@ -1297,9 +1297,9 @@ func (cli *DockerCli) printVizNode(noTrunc bool, image *engine.Env, prefix strin
1297 1297
 func (cli *DockerCli) printTreeNode(noTrunc bool, image *engine.Env, prefix string) {
1298 1298
 	var imageID string
1299 1299
 	if noTrunc {
1300
-		imageID = image.Get("ID")
1300
+		imageID = image.Get("Id")
1301 1301
 	} else {
1302
-		imageID = utils.TruncateID(image.Get("ID"))
1302
+		imageID = utils.TruncateID(image.Get("Id"))
1303 1303
 	}
1304 1304
 
1305 1305
 	fmt.Fprintf(cli.out, "%s%s Virtual Size: %s", prefix, imageID, utils.HumanSize(image.GetInt64("VirtualSize")))
... ...
@@ -1378,7 +1378,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {
1378 1378
 
1379 1379
 	for _, out := range outs.Data {
1380 1380
 		var (
1381
-			outID    = out.Get("ID")
1381
+			outID    = out.Get("Id")
1382 1382
 			outNames = out.GetList("Names")
1383 1383
 		)
1384 1384
 
... ...
@@ -204,7 +204,7 @@ func TestGetImagesJSON(t *testing.T) {
204 204
 	}
205 205
 	assertHttpNotError(r2, t)
206 206
 
207
-	images2 := engine.NewTable("ID", 0)
207
+	images2 := engine.NewTable("Id", 0)
208 208
 	if _, err := images2.ReadListFrom(r2.Body.Bytes()); err != nil {
209 209
 		t.Fatal(err)
210 210
 	}
... ...
@@ -215,7 +215,7 @@ func TestGetImagesJSON(t *testing.T) {
215 215
 
216 216
 	found = false
217 217
 	for _, img := range images2.Data {
218
-		if img.Get("ID") == unitTestImageID {
218
+		if img.Get("Id") == unitTestImageID {
219 219
 			found = true
220 220
 			break
221 221
 		}
... ...
@@ -237,7 +237,7 @@ func TestGetImagesJSON(t *testing.T) {
237 237
 	}
238 238
 	assertHttpNotError(r3, t)
239 239
 
240
-	images3 := engine.NewTable("ID", 0)
240
+	images3 := engine.NewTable("Id", 0)
241 241
 	if _, err := images3.ReadListFrom(r3.Body.Bytes()); err != nil {
242 242
 		t.Fatal(err)
243 243
 	}
... ...
@@ -339,7 +339,7 @@ func TestGetContainersJSON(t *testing.T) {
339 339
 	if len(containers.Data) != beginLen+1 {
340 340
 		t.Fatalf("Expected %d container, %d found (started with: %d)", beginLen+1, len(containers.Data), beginLen)
341 341
 	}
342
-	if id := containers.Data[0].Get("ID"); id != containerID {
342
+	if id := containers.Data[0].Get("Id"); id != containerID {
343 343
 		t.Fatalf("Container ID mismatch. Expected: %s, received: %s\n", containerID, id)
344 344
 	}
345 345
 }
... ...
@@ -60,8 +60,8 @@ func cleanup(eng *engine.Engine, t *testing.T) error {
60 60
 		t.Fatal(err)
61 61
 	}
62 62
 	for _, image := range images.Data {
63
-		if image.Get("ID") != unitTestImageID {
64
-			mkServerFromEngine(eng, t).DeleteImage(image.Get("ID"), false)
63
+		if image.Get("Id") != unitTestImageID {
64
+			mkServerFromEngine(eng, t).DeleteImage(image.Get("Id"), false)
65 65
 		}
66 66
 	}
67 67
 	return nil
... ...
@@ -264,7 +264,7 @@ func TestRestartKillWait(t *testing.T) {
264 264
 	}
265 265
 
266 266
 	setTimeout(t, "Waiting on stopped container timedout", 5*time.Second, func() {
267
-		job = srv.Eng.Job("wait", outs.Data[0].Get("ID"))
267
+		job = srv.Eng.Job("wait", outs.Data[0].Get("Id"))
268 268
 		var statusStr string
269 269
 		job.Stdout.AddString(&statusStr)
270 270
 		if err := job.Run(); err != nil {
... ...
@@ -448,7 +448,7 @@ func TestRmi(t *testing.T) {
448 448
 	}
449 449
 
450 450
 	for _, image := range images.Data {
451
-		if strings.Contains(unitTestImageID, image.Get("ID")) {
451
+		if strings.Contains(unitTestImageID, image.Get("Id")) {
452 452
 			continue
453 453
 		}
454 454
 		if image.GetList("RepoTags")[0] == "<none>:<none>" {
... ...
@@ -626,7 +626,7 @@ func assertContainerList(srv *docker.Server, all bool, limit int, since, before
626 626
 		return false
627 627
 	}
628 628
 	for i := 0; i < len(outs.Data); i++ {
629
-		if outs.Data[i].Get("ID") != expected[i] {
629
+		if outs.Data[i].Get("Id") != expected[i] {
630 630
 			return false
631 631
 		}
632 632
 	}
... ...
@@ -833,7 +833,7 @@ func (srv *Server) Images(job *engine.Job) engine.Status {
833 833
 				delete(allImages, id)
834 834
 				out.Set("ParentId", image.Parent)
835 835
 				out.SetList("RepoTags", []string{fmt.Sprintf("%s:%s", name, tag)})
836
-				out.Set("ID", image.ID)
836
+				out.Set("Id", image.ID)
837 837
 				out.SetInt64("Created", image.Created.Unix())
838 838
 				out.SetInt64("Size", image.Size)
839 839
 				out.SetInt64("VirtualSize", image.getParentsSize(0)+image.Size)
... ...
@@ -854,7 +854,7 @@ func (srv *Server) Images(job *engine.Job) engine.Status {
854 854
 			out := &engine.Env{}
855 855
 			out.Set("ParentId", image.Parent)
856 856
 			out.SetList("RepoTags", []string{"<none>:<none>"})
857
-			out.Set("ID", image.ID)
857
+			out.Set("Id", image.ID)
858 858
 			out.SetInt64("Created", image.Created.Unix())
859 859
 			out.SetInt64("Size", image.Size)
860 860
 			out.SetInt64("VirtualSize", image.getParentsSize(0)+image.Size)
... ...
@@ -940,7 +940,7 @@ func (srv *Server) ImageHistory(job *engine.Job) engine.Status {
940 940
 	outs := engine.NewTable("Created", 0)
941 941
 	err = image.WalkHistory(func(img *Image) error {
942 942
 		out := &engine.Env{}
943
-		out.Set("ID", img.ID)
943
+		out.Set("Id", img.ID)
944 944
 		out.SetInt64("Created", img.Created.Unix())
945 945
 		out.Set("CreatedBy", strings.Join(img.ContainerConfig.Cmd, " "))
946 946
 		out.SetList("Tags", lookupMap[img.ID])
... ...
@@ -1101,7 +1101,7 @@ func (srv *Server) Containers(job *engine.Job) engine.Status {
1101 1101
 		}
1102 1102
 		displayed++
1103 1103
 		out := &engine.Env{}
1104
-		out.Set("ID", container.ID)
1104
+		out.Set("Id", container.ID)
1105 1105
 		out.SetList("Names", names[container.ID])
1106 1106
 		out.Set("Image", srv.runtime.repositories.ImageName(container.Image))
1107 1107
 		out.Set("Command", fmt.Sprintf("%s %s", container.Path, strings.Join(container.Args, " ")))