mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
fix ID -> Id api
Docker-DCO-1.1-Signed-off-by: Victor Vieux <victor.vieux@docker.com> (github: vieux)
This commit is contained in:
parent
6013cbdce8
commit
54072dbbd6
5 changed files with 24 additions and 24 deletions
22
commands.go
22
commands.go
|
@ -875,7 +875,7 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
|
|||
}
|
||||
|
||||
for _, out := range outs.Data {
|
||||
outID := out.Get("ID")
|
||||
outID := out.Get("Id")
|
||||
if !*quiet {
|
||||
if *noTrunc {
|
||||
fmt.Fprintf(w, "%s\t", outID)
|
||||
|
@ -1167,7 +1167,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
|||
}
|
||||
|
||||
if filter != "" {
|
||||
if filter == image.Get("ID") || filter == utils.TruncateID(image.Get("ID")) {
|
||||
if filter == image.Get("Id") || filter == utils.TruncateID(image.Get("Id")) {
|
||||
startImage = image
|
||||
}
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ func (cli *DockerCli) CmdImages(args ...string) error {
|
|||
for _, repotag := range out.GetList("RepoTags") {
|
||||
|
||||
repo, tag := utils.ParseRepositoryTag(repotag)
|
||||
outID := out.Get("ID")
|
||||
outID := out.Get("Id")
|
||||
if !*noTrunc {
|
||||
outID = utils.TruncateID(outID)
|
||||
}
|
||||
|
@ -1251,12 +1251,12 @@ func (cli *DockerCli) WalkTree(noTrunc bool, images *engine.Table, byParent map[
|
|||
for index, image := range images.Data {
|
||||
if index+1 == length {
|
||||
printNode(cli, noTrunc, image, prefix+"└─")
|
||||
if subimages, exists := byParent[image.Get("ID")]; exists {
|
||||
if subimages, exists := byParent[image.Get("Id")]; exists {
|
||||
cli.WalkTree(noTrunc, subimages, byParent, prefix+" ", printNode)
|
||||
}
|
||||
} else {
|
||||
printNode(cli, noTrunc, image, prefix+"\u251C─")
|
||||
if subimages, exists := byParent[image.Get("ID")]; exists {
|
||||
if subimages, exists := byParent[image.Get("Id")]; exists {
|
||||
cli.WalkTree(noTrunc, subimages, byParent, prefix+"\u2502 ", printNode)
|
||||
}
|
||||
}
|
||||
|
@ -1264,7 +1264,7 @@ func (cli *DockerCli) WalkTree(noTrunc bool, images *engine.Table, byParent map[
|
|||
} else {
|
||||
for _, image := range images.Data {
|
||||
printNode(cli, noTrunc, image, prefix+"└─")
|
||||
if subimages, exists := byParent[image.Get("ID")]; exists {
|
||||
if subimages, exists := byParent[image.Get("Id")]; exists {
|
||||
cli.WalkTree(noTrunc, subimages, byParent, prefix+" ", printNode)
|
||||
}
|
||||
}
|
||||
|
@ -1277,10 +1277,10 @@ func (cli *DockerCli) printVizNode(noTrunc bool, image *engine.Env, prefix strin
|
|||
parentID string
|
||||
)
|
||||
if noTrunc {
|
||||
imageID = image.Get("ID")
|
||||
imageID = image.Get("Id")
|
||||
parentID = image.Get("ParentId")
|
||||
} else {
|
||||
imageID = utils.TruncateID(image.Get("ID"))
|
||||
imageID = utils.TruncateID(image.Get("Id"))
|
||||
parentID = utils.TruncateID(image.Get("ParentId"))
|
||||
}
|
||||
if parentID == "" {
|
||||
|
@ -1297,9 +1297,9 @@ func (cli *DockerCli) printVizNode(noTrunc bool, image *engine.Env, prefix strin
|
|||
func (cli *DockerCli) printTreeNode(noTrunc bool, image *engine.Env, prefix string) {
|
||||
var imageID string
|
||||
if noTrunc {
|
||||
imageID = image.Get("ID")
|
||||
imageID = image.Get("Id")
|
||||
} else {
|
||||
imageID = utils.TruncateID(image.Get("ID"))
|
||||
imageID = utils.TruncateID(image.Get("Id"))
|
||||
}
|
||||
|
||||
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 {
|
|||
|
||||
for _, out := range outs.Data {
|
||||
var (
|
||||
outID = out.Get("ID")
|
||||
outID = out.Get("Id")
|
||||
outNames = out.GetList("Names")
|
||||
)
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ func TestGetImagesJSON(t *testing.T) {
|
|||
}
|
||||
assertHttpNotError(r2, t)
|
||||
|
||||
images2 := engine.NewTable("ID", 0)
|
||||
images2 := engine.NewTable("Id", 0)
|
||||
if _, err := images2.ReadListFrom(r2.Body.Bytes()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -215,7 +215,7 @@ func TestGetImagesJSON(t *testing.T) {
|
|||
|
||||
found = false
|
||||
for _, img := range images2.Data {
|
||||
if img.Get("ID") == unitTestImageID {
|
||||
if img.Get("Id") == unitTestImageID {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ func TestGetImagesJSON(t *testing.T) {
|
|||
}
|
||||
assertHttpNotError(r3, t)
|
||||
|
||||
images3 := engine.NewTable("ID", 0)
|
||||
images3 := engine.NewTable("Id", 0)
|
||||
if _, err := images3.ReadListFrom(r3.Body.Bytes()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -339,7 +339,7 @@ func TestGetContainersJSON(t *testing.T) {
|
|||
if len(containers.Data) != beginLen+1 {
|
||||
t.Fatalf("Expected %d container, %d found (started with: %d)", beginLen+1, len(containers.Data), beginLen)
|
||||
}
|
||||
if id := containers.Data[0].Get("ID"); id != containerID {
|
||||
if id := containers.Data[0].Get("Id"); id != containerID {
|
||||
t.Fatalf("Container ID mismatch. Expected: %s, received: %s\n", containerID, id)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ func cleanup(eng *engine.Engine, t *testing.T) error {
|
|||
t.Fatal(err)
|
||||
}
|
||||
for _, image := range images.Data {
|
||||
if image.Get("ID") != unitTestImageID {
|
||||
mkServerFromEngine(eng, t).DeleteImage(image.Get("ID"), false)
|
||||
if image.Get("Id") != unitTestImageID {
|
||||
mkServerFromEngine(eng, t).DeleteImage(image.Get("Id"), false)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -264,7 +264,7 @@ func TestRestartKillWait(t *testing.T) {
|
|||
}
|
||||
|
||||
setTimeout(t, "Waiting on stopped container timedout", 5*time.Second, func() {
|
||||
job = srv.Eng.Job("wait", outs.Data[0].Get("ID"))
|
||||
job = srv.Eng.Job("wait", outs.Data[0].Get("Id"))
|
||||
var statusStr string
|
||||
job.Stdout.AddString(&statusStr)
|
||||
if err := job.Run(); err != nil {
|
||||
|
@ -448,7 +448,7 @@ func TestRmi(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, image := range images.Data {
|
||||
if strings.Contains(unitTestImageID, image.Get("ID")) {
|
||||
if strings.Contains(unitTestImageID, image.Get("Id")) {
|
||||
continue
|
||||
}
|
||||
if image.GetList("RepoTags")[0] == "<none>:<none>" {
|
||||
|
@ -626,7 +626,7 @@ func assertContainerList(srv *docker.Server, all bool, limit int, since, before
|
|||
return false
|
||||
}
|
||||
for i := 0; i < len(outs.Data); i++ {
|
||||
if outs.Data[i].Get("ID") != expected[i] {
|
||||
if outs.Data[i].Get("Id") != expected[i] {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -833,7 +833,7 @@ func (srv *Server) Images(job *engine.Job) engine.Status {
|
|||
delete(allImages, id)
|
||||
out.Set("ParentId", image.Parent)
|
||||
out.SetList("RepoTags", []string{fmt.Sprintf("%s:%s", name, tag)})
|
||||
out.Set("ID", image.ID)
|
||||
out.Set("Id", image.ID)
|
||||
out.SetInt64("Created", image.Created.Unix())
|
||||
out.SetInt64("Size", image.Size)
|
||||
out.SetInt64("VirtualSize", image.getParentsSize(0)+image.Size)
|
||||
|
@ -854,7 +854,7 @@ func (srv *Server) Images(job *engine.Job) engine.Status {
|
|||
out := &engine.Env{}
|
||||
out.Set("ParentId", image.Parent)
|
||||
out.SetList("RepoTags", []string{"<none>:<none>"})
|
||||
out.Set("ID", image.ID)
|
||||
out.Set("Id", image.ID)
|
||||
out.SetInt64("Created", image.Created.Unix())
|
||||
out.SetInt64("Size", image.Size)
|
||||
out.SetInt64("VirtualSize", image.getParentsSize(0)+image.Size)
|
||||
|
@ -940,7 +940,7 @@ func (srv *Server) ImageHistory(job *engine.Job) engine.Status {
|
|||
outs := engine.NewTable("Created", 0)
|
||||
err = image.WalkHistory(func(img *Image) error {
|
||||
out := &engine.Env{}
|
||||
out.Set("ID", img.ID)
|
||||
out.Set("Id", img.ID)
|
||||
out.SetInt64("Created", img.Created.Unix())
|
||||
out.Set("CreatedBy", strings.Join(img.ContainerConfig.Cmd, " "))
|
||||
out.SetList("Tags", lookupMap[img.ID])
|
||||
|
@ -1101,7 +1101,7 @@ func (srv *Server) Containers(job *engine.Job) engine.Status {
|
|||
}
|
||||
displayed++
|
||||
out := &engine.Env{}
|
||||
out.Set("ID", container.ID)
|
||||
out.Set("Id", container.ID)
|
||||
out.SetList("Names", names[container.ID])
|
||||
out.Set("Image", srv.runtime.repositories.ImageName(container.Image))
|
||||
out.Set("Command", fmt.Sprintf("%s %s", container.Path, strings.Join(container.Args, " ")))
|
||||
|
|
Loading…
Add table
Reference in a new issue