fix containers/image progress

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca 2016-09-26 16:48:18 +02:00
parent 5b7fcc8eca
commit 0420fa0299
No known key found for this signature in database
GPG Key ID: B2BEAD150DE936B9

View File

@ -91,11 +91,12 @@ type Options struct {
// Image copies image from srcRef to destRef, using policyContext to validate source image admissibility. // Image copies image from srcRef to destRef, using policyContext to validate source image admissibility.
func Image(ctx *types.SystemContext, policyContext *signature.PolicyContext, destRef, srcRef types.ImageReference, options *Options) error { func Image(ctx *types.SystemContext, policyContext *signature.PolicyContext, destRef, srcRef types.ImageReference, options *Options) error {
if options.ReportWriter == nil { reportWriter := options.ReportWriter
options.ReportWriter = ioutil.Discard if reportWriter == nil {
reportWriter = ioutil.Discard
} }
writeReport := func(f string, a ...interface{}) { writeReport := func(f string, a ...interface{}) {
fmt.Fprintf(options.ReportWriter, f, a...) fmt.Fprintf(reportWriter, f, a...)
} }
dest, err := destRef.NewImageDestination(ctx) dest, err := destRef.NewImageDestination(ctx)
if err != nil { if err != nil {
@ -270,11 +271,7 @@ func copyBlob(dest types.ImageDestination, src types.ImageSource, srcInfo types.
bar.Start() bar.Start()
destStream = bar.NewProxyReader(destStream) destStream = bar.NewProxyReader(destStream)
defer func() { defer fmt.Fprint(reportWriter, "\n")
if err != nil {
fmt.Fprint(reportWriter, "\n")
}
}()
var inputInfo types.BlobInfo var inputInfo types.BlobInfo
if !canCompress || isCompressed || !dest.ShouldCompressLayers() { if !canCompress || isCompressed || !dest.ShouldCompressLayers() {