From 96ae98d2d5c8dec11a2167b20176ffd0b5c02fbb Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Tue, 9 May 2017 13:10:19 +0100 Subject: [PATCH] Do not log information about empty sections Signed-off-by: Justin Cormack --- cmd/moby/build.go | 12 +++++++++--- cmd/moby/config.go | 4 +++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/cmd/moby/build.go b/cmd/moby/build.go index 439aa786d..71cfd188b 100644 --- a/cmd/moby/build.go +++ b/cmd/moby/build.go @@ -159,7 +159,9 @@ func buildInternal(m *Moby, name string, pull bool) []byte { } // convert init images to tarballs - log.Infof("Add init containers:") + if len(m.Init) != 0 { + log.Infof("Add init containers:") + } for _, ii := range m.Init { log.Infof("Process init image: %s", ii) init, err := ImageExtract(ii, "", enforceContentTrust(ii, &m.Trust), pull) @@ -170,7 +172,9 @@ func buildInternal(m *Moby, name string, pull bool) []byte { initrdAppend(iw, buffer) } - log.Infof("Add onboot containers:") + if len(m.Onboot) != 0 { + log.Infof("Add onboot containers:") + } for i, image := range m.Onboot { log.Infof(" Create OCI config for %s", image.Image) config, err := ConfigToOCI(&image) @@ -187,7 +191,9 @@ func buildInternal(m *Moby, name string, pull bool) []byte { initrdAppend(iw, buffer) } - log.Infof("Add service containers:") + if len(m.Services) != 0 { + log.Infof("Add service containers:") + } for _, image := range m.Services { log.Infof(" Create OCI config for %s", image.Image) config, err := ConfigToOCI(&image) diff --git a/cmd/moby/config.go b/cmd/moby/config.go index 2c7726ebd..90b807aa8 100644 --- a/cmd/moby/config.go +++ b/cmd/moby/config.go @@ -430,7 +430,9 @@ func filesystem(m *Moby) (*bytes.Buffer, error) { tw := tar.NewWriter(buf) defer tw.Close() - log.Infof("Add files:") + if len(m.Files) != 0 { + log.Infof("Add files:") + } for _, f := range m.Files { log.Infof(" %s", f.Path) if f.Path == "" {