diff options
author | Vincent Demeester <vincent@sbr.pm> | 2016-06-10 12:07:32 +0200 |
---|---|---|
committer | Vincent Demeester <vincent@sbr.pm> | 2016-06-10 12:07:32 +0200 |
commit | ad4e20cd92079ec59b175b8a687ddadfa00037eb (patch) | |
tree | c5e5b5cb963dab9b605f3f0164db3f567e9c3c09 | |
parent | 9640e3a4514f96a890310757a09fd77a3c70e931 (diff) | |
download | docker-ad4e20cd92079ec59b175b8a687ddadfa00037eb.tar.gz |
Moving Image{Push,Pull}Privileged to trust.go
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
-rw-r--r-- | api/client/commands.go | 1 | ||||
-rw-r--r-- | api/client/image/pull.go | 1 | ||||
-rw-r--r-- | api/client/image/push.go | 1 | ||||
-rw-r--r-- | api/client/pull.go | 30 | ||||
-rw-r--r-- | api/client/push.go | 23 | ||||
-rw-r--r-- | api/client/trust.go | 37 | ||||
-rw-r--r-- | cli/usage.go | 1 |
7 files changed, 37 insertions, 57 deletions
diff --git a/api/client/commands.go b/api/client/commands.go index d6f5aebdac..6d6d9c8763 100644 --- a/api/client/commands.go +++ b/api/client/commands.go @@ -11,7 +11,6 @@ func (cli *DockerCli) Command(name string) func(...string) error { "login": cli.CmdLogin, "logout": cli.CmdLogout, "ps": cli.CmdPs, - "push": cli.CmdPush, "update": cli.CmdUpdate, }[name] } diff --git a/api/client/image/pull.go b/api/client/image/pull.go index 24d91e4a63..e5968db269 100644 --- a/api/client/image/pull.go +++ b/api/client/image/pull.go @@ -41,7 +41,6 @@ func NewPullCommand(dockerCli *client.DockerCli) *cobra.Command { } func runPull(dockerCli *client.DockerCli, opts pullOptions) error { - distributionRef, err := reference.ParseNamed(opts.remote) if err != nil { return err diff --git a/api/client/image/push.go b/api/client/image/push.go index 54527a0fb9..35d1645952 100644 --- a/api/client/image/push.go +++ b/api/client/image/push.go @@ -30,7 +30,6 @@ func NewPushCommand(dockerCli *client.DockerCli) *cobra.Command { } func runPush(dockerCli *client.DockerCli, remote string) error { - ref, err := reference.ParseNamed(remote) if err != nil { return err diff --git a/api/client/pull.go b/api/client/pull.go deleted file mode 100644 index c0cef6f009..0000000000 --- a/api/client/pull.go +++ /dev/null @@ -1,30 +0,0 @@ -package client - -import ( - "golang.org/x/net/context" - - "github.com/docker/docker/pkg/jsonmessage" - "github.com/docker/engine-api/types" -) - -// ImagePullPrivileged pulls the image and displays it to the output -func (cli *DockerCli) ImagePullPrivileged(ctx context.Context, authConfig types.AuthConfig, ref string, requestPrivilege types.RequestPrivilegeFunc, all bool) error { - - encodedAuth, err := EncodeAuthToBase64(authConfig) - if err != nil { - return err - } - options := types.ImagePullOptions{ - RegistryAuth: encodedAuth, - PrivilegeFunc: requestPrivilege, - All: all, - } - - responseBody, err := cli.client.ImagePull(ctx, ref, options) - if err != nil { - return err - } - defer responseBody.Close() - - return jsonmessage.DisplayJSONMessagesStream(responseBody, cli.out, cli.outFd, cli.isTerminalOut, nil) -} diff --git a/api/client/push.go b/api/client/push.go deleted file mode 100644 index 5c1e40124f..0000000000 --- a/api/client/push.go +++ /dev/null @@ -1,23 +0,0 @@ -package client - -import ( - "io" - - "golang.org/x/net/context" - - "github.com/docker/engine-api/types" -) - -// ImagePushPrivileged push the image -func (cli *DockerCli) ImagePushPrivileged(ctx context.Context, authConfig types.AuthConfig, ref string, requestPrivilege types.RequestPrivilegeFunc) (io.ReadCloser, error) { - encodedAuth, err := EncodeAuthToBase64(authConfig) - if err != nil { - return nil, err - } - options := types.ImagePushOptions{ - RegistryAuth: encodedAuth, - PrivilegeFunc: requestPrivilege, - } - - return cli.client.ImagePush(ctx, ref, options) -} diff --git a/api/client/trust.go b/api/client/trust.go index 3311b4a078..273b5e4c4a 100644 --- a/api/client/trust.go +++ b/api/client/trust.go @@ -5,6 +5,7 @@ import ( "encoding/json" "errors" "fmt" + "io" "net" "net/http" "net/url" @@ -566,3 +567,39 @@ func (cli *DockerCli) addTargetToAllSignableRoles(repo *client.NotaryRepository, return repo.AddTarget(target, signableRoles...) } + +// ImagePullPrivileged pulls the image and displays it to the output +func (cli *DockerCli) ImagePullPrivileged(ctx context.Context, authConfig types.AuthConfig, ref string, requestPrivilege types.RequestPrivilegeFunc, all bool) error { + + encodedAuth, err := EncodeAuthToBase64(authConfig) + if err != nil { + return err + } + options := types.ImagePullOptions{ + RegistryAuth: encodedAuth, + PrivilegeFunc: requestPrivilege, + All: all, + } + + responseBody, err := cli.client.ImagePull(ctx, ref, options) + if err != nil { + return err + } + defer responseBody.Close() + + return jsonmessage.DisplayJSONMessagesStream(responseBody, cli.out, cli.outFd, cli.isTerminalOut, nil) +} + +// ImagePushPrivileged push the image +func (cli *DockerCli) ImagePushPrivileged(ctx context.Context, authConfig types.AuthConfig, ref string, requestPrivilege types.RequestPrivilegeFunc) (io.ReadCloser, error) { + encodedAuth, err := EncodeAuthToBase64(authConfig) + if err != nil { + return nil, err + } + options := types.ImagePushOptions{ + RegistryAuth: encodedAuth, + PrivilegeFunc: requestPrivilege, + } + + return cli.client.ImagePush(ctx, ref, options) +} diff --git a/cli/usage.go b/cli/usage.go index c063dd0da6..7ebbf2d12f 100644 --- a/cli/usage.go +++ b/cli/usage.go @@ -16,7 +16,6 @@ var DockerCommandUsage = []Command{ {"login", "Log in to a Docker registry"}, {"logout", "Log out from a Docker registry"}, {"ps", "List containers"}, - {"push", "Push an image or a repository to a registry"}, {"update", "Update configuration of one or more containers"}, } |