mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #3829 from vieux/fix_api_regression
Fix ID -> Id api
This commit is contained in:
commit
643c7dc25d
5 changed files with 24 additions and 24 deletions
22
commands.go
22
commands.go
|
@ -878,7 +878,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)
|
||||
|
@ -1170,7 +1170,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
|
||||
}
|
||||
|
||||
|
@ -1228,7 +1228,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)
|
||||
}
|
||||
|
@ -1254,12 +1254,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)
|
||||
}
|
||||
}
|
||||
|
@ -1267,7 +1267,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)
|
||||
}
|
||||
}
|
||||
|
@ -1280,10 +1280,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 == "" {
|
||||
|
@ -1300,9 +1300,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")))
|
||||
|
@ -1381,7 +1381,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
|
||||
|
|
|
@ -288,7 +288,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 {
|
||||
|
@ -472,7 +472,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>" {
|
||||
|
@ -650,7 +650,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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -776,7 +776,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)
|
||||
|
@ -797,7 +797,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)
|
||||
|
@ -879,7 +879,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])
|
||||
|
@ -1027,7 +1027,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