diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2017-11-07 08:53:06 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-07 15:37:50 +0000 |
commit | df54adeaae6e247bfe07b39fa3e2a2c0a5e8f335 (patch) | |
tree | 15d810d0b301251abc9d4d017e6413ef9db6b089 /libpod | |
parent | a39ec628e729c7dde6b1972fdfe1e6acc4851182 (diff) | |
download | podman-df54adeaae6e247bfe07b39fa3e2a2c0a5e8f335.tar.gz podman-df54adeaae6e247bfe07b39fa3e2a2c0a5e8f335.tar.bz2 podman-df54adeaae6e247bfe07b39fa3e2a2c0a5e8f335.zip |
Respect the quiet flag.
When setting the `kpod load -q` flag, output was still going to the
screen. This patch adds a check to not output to the terminal unless
there is an io.Writer specified, and then to write to the io.Writer.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Closes: #23
Approved by: rhatdan
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/runtime_img.go | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go index d291840e9..a57aec86c 100644 --- a/libpod/runtime_img.go +++ b/libpod/runtime_img.go @@ -409,8 +409,7 @@ func getRegistriesToTry(image string, store storage.Store) ([]*pullStruct, error } searchRegistries, err := sysregistries.GetRegistries(&types.SystemContext{SystemRegistriesConfPath: registryConfigPath}) if err != nil { - fmt.Println(err) - return nil, errors.Errorf("unable to parse the registries.conf file and"+ + return nil, errors.Wrapf(err, "unable to parse the registries.conf file and"+ " the image name '%s' is incomplete.", imageName) } for _, searchRegistry := range searchRegistries { @@ -587,9 +586,13 @@ func (r *Runtime) PullImage(imgName string, options CopyOptions) error { copyOptions := common.GetCopyOptions(options.Writer, signaturePolicyPath, &options.DockerRegistryOptions, nil, options.SigningOptions, options.AuthFile) for _, imageInfo := range pullStructs { - fmt.Printf("Trying to pull %s...\n", imageInfo.image) + if options.Writer != nil { + io.WriteString(options.Writer, fmt.Sprintf("Trying to pull %s...\n", imageInfo.image)) + } if err = cp.Image(policyContext, imageInfo.dstRef, imageInfo.srcRef, copyOptions); err != nil { - fmt.Println("Failed") + if options.Writer != nil { + io.WriteString(options.Writer, "Failed\n") + } } else { return nil } |