From f60e64cd70aa107dda8a1c2ee36a58f51f269d79 Mon Sep 17 00:00:00 2001 From: Dinesh Subhraveti Date: Sun, 7 Jun 2015 19:29:25 +0000 Subject: [PATCH] Add changes to import image --- dockerclient.go | 5 ++++- interface.go | 2 +- mockclient/mock.go | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dockerclient.go b/dockerclient.go index fe2a648..9ec9668 100644 --- a/dockerclient.go +++ b/dockerclient.go @@ -580,7 +580,7 @@ func (client *DockerClient) RenameContainer(oldName string, newName string) erro return err } -func (client *DockerClient) ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error) { +func (client *DockerClient) ImportImage(source string, repository string, tag string, changes *[]string, tar io.Reader) (io.ReadCloser, error) { var fromSrc string v := &url.Values{} if source == "" { @@ -594,6 +594,9 @@ func (client *DockerClient) ImportImage(source string, repository string, tag st if tag != "" { v.Set("tag", tag) } + for _, change := range *changes { + v.Add("changes", change) + } var in io.Reader if fromSrc == "-" { diff --git a/interface.go b/interface.go index f3d3f14..915436a 100644 --- a/interface.go +++ b/interface.go @@ -40,5 +40,5 @@ type Client interface { PauseContainer(name string) error UnpauseContainer(name string) error RenameContainer(oldName string, newName string) error - ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error) + ImportImage(source string, repository string, tag string, changes *[]string, tar io.Reader) (io.ReadCloser, error) } diff --git a/mockclient/mock.go b/mockclient/mock.go index 0facc9c..5db2806 100644 --- a/mockclient/mock.go +++ b/mockclient/mock.go @@ -146,7 +146,7 @@ func (client *MockClient) RenameContainer(oldName string, newName string) error return args.Error(0) } -func (client *MockClient) ImportImage(source string, repository string, tag string, tar io.Reader) (io.ReadCloser, error) { - args := client.Mock.Called(source, repository, tag, tar) +func (client *MockClient) ImportImage(source string, repository string, tag string, changes *[]string, tar io.Reader) (io.ReadCloser, error) { + args := client.Mock.Called(source, repository, tag, changes, tar) return args.Get(0).(io.ReadCloser), args.Error(1) }