From afb8e9cf717cc3b86d7fc44ddcfe4fe3cc57f54e Mon Sep 17 00:00:00 2001 From: creack Date: Fri, 22 Mar 2013 03:10:09 -0700 Subject: [PATCH] Add some verbosity to the push/pull features --- storage/commands.go | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/storage/commands.go b/storage/commands.go index 3e5fddf18c..2e999fac12 100644 --- a/storage/commands.go +++ b/storage/commands.go @@ -440,15 +440,24 @@ func (srv *Server) CmdPush(stdin io.ReadCloser, stdout io.Writer, args ...string } // If it fails, try to get the repository if repo, exists := srv.runtime.repositories.Repositories[cmd.Arg(0)]; exists { + fmt.Fprintf(stdout, "Pushing %s (%d images) on %s...\n", cmd.Arg(0), len(repo), *user+"/"+cmd.Arg(0)) if err := srv.runtime.graph.PushRepository(*user, cmd.Arg(0), repo, srv.runtime.authConfig); err != nil { return err } + fmt.Fprintf(stdout, "Push completed\n") + return nil } else { return err } return nil } - return srv.runtime.graph.PushImage(img, srv.runtime.authConfig) + fmt.Fprintf(stdout, "Pushing image %s..\n", img.Id) + err = srv.runtime.graph.PushImage(img, srv.runtime.authConfig) + if err != nil { + return err + } + fmt.Fprintf(stdout, "Push completed\n") + return nil } func (srv *Server) CmdPull(stdin io.ReadCloser, stdout io.Writer, args ...string) error { @@ -463,13 +472,23 @@ func (srv *Server) CmdPull(stdin io.ReadCloser, stdout io.Writer, args ...string } if srv.runtime.graph.LookupRemoteImage(cmd.Arg(0), srv.runtime.authConfig) { - return srv.runtime.graph.PullImage(cmd.Arg(0), srv.runtime.authConfig) + fmt.Fprintf(stdout, "Pulling %s...\n", cmd.Arg(0)) + if err := srv.runtime.graph.PullImage(cmd.Arg(0), srv.runtime.authConfig); err != nil { + return err + } + fmt.Fprintf(stdout, "Pulled\n") + return nil } if *user == "" { return fmt.Errorf("Not loggin and no user specified\n") } // FIXME: Allow pull repo:tag - return srv.runtime.graph.PullRepository(*user, cmd.Arg(0), "", srv.runtime.repositories, srv.runtime.authConfig) + fmt.Fprintf(stdout, "Pulling %s from %s...\n", cmd.Arg(0), *user+"/"+cmd.Arg(0)) + if err := srv.runtime.graph.PullRepository(*user, cmd.Arg(0), "", srv.runtime.repositories, srv.runtime.authConfig); err != nil { + return err + } + fmt.Fprintf(stdout, "Pull completed\n") + return nil } func (srv *Server) CmdImages(stdin io.ReadCloser, stdout io.Writer, args ...string) error {