diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/server/server.go | 11 | ||||
-rw-r--r-- | pkg/domain/entities/engine_image.go | 1 | ||||
-rw-r--r-- | pkg/domain/infra/abi/images.go | 9 | ||||
-rw-r--r-- | pkg/domain/infra/abi/manifest.go | 33 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/manifest.go | 5 |
5 files changed, 27 insertions, 32 deletions
diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go index e23448fd1..972541bc6 100644 --- a/pkg/api/server/server.go +++ b/pkg/api/server/server.go @@ -136,7 +136,7 @@ func newServer(runtime *libpod.Runtime, duration time.Duration, listener *net.Li } } - if logrus.IsLevelEnabled(logrus.DebugLevel) { + if logrus.IsLevelEnabled(logrus.TraceLevel) { router.Walk(func(route *mux.Route, r *mux.Router, ancestors []*mux.Route) error { // nolint path, err := route.GetPathTemplate() if err != nil { @@ -146,7 +146,7 @@ func newServer(runtime *libpod.Runtime, duration time.Duration, listener *net.Li if err != nil { methods = []string{"<N/A>"} } - logrus.Debugf("Methods: %6s Path: %s", strings.Join(methods, ", "), path) + logrus.Tracef("Methods: %6s Path: %s", strings.Join(methods, ", "), path) return nil }) } @@ -162,13 +162,12 @@ func setupSystemd() { if len(os.Getenv("NOTIFY_SOCKET")) == 0 { return } - payload := fmt.Sprintf("MAINPID=%d", os.Getpid()) - payload += "\n" + payload := fmt.Sprintf("MAINPID=%d\n", os.Getpid()) payload += daemon.SdNotifyReady if sent, err := daemon.SdNotify(true, payload); err != nil { logrus.Errorf("Error notifying systemd of Conmon PID: %s", err.Error()) - } else if sent { - logrus.Debugf("Notify sent successfully") + } else if !sent { + logrus.Warn("SDNotify not sent successfully") } if err := os.Unsetenv("INVOCATION_ID"); err != nil { diff --git a/pkg/domain/entities/engine_image.go b/pkg/domain/entities/engine_image.go index d841ecd6e..1b2de5d5e 100644 --- a/pkg/domain/entities/engine_image.go +++ b/pkg/domain/entities/engine_image.go @@ -37,6 +37,7 @@ type ImageEngine interface { ManifestAdd(ctx context.Context, opts ManifestAddOptions) (string, error) ManifestAnnotate(ctx context.Context, names []string, opts ManifestAnnotateOptions) (string, error) ManifestRemove(ctx context.Context, names []string) (string, error) + ManifestRm(ctx context.Context, names []string) (*ImageRemoveReport, []error) ManifestPush(ctx context.Context, name, destination string, imagePushOpts ImagePushOptions) (string, error) Sign(ctx context.Context, names []string, options SignOptions) (*SignReport, error) } diff --git a/pkg/domain/infra/abi/images.go b/pkg/domain/infra/abi/images.go index 79e815490..083566201 100644 --- a/pkg/domain/infra/abi/images.go +++ b/pkg/domain/infra/abi/images.go @@ -313,12 +313,9 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri // list but could not find a matching image instance in the local // containers storage. In that case, fall back and attempt to push the // (entire) manifest. - if errors.Cause(pushError) == storage.ErrImageUnknown { - // Image might be a manifest list so attempt a manifest push - _, manifestErr := ir.ManifestPush(ctx, source, destination, options) - if manifestErr == nil { - return nil - } + if _, err := ir.Libpod.LibimageRuntime().LookupManifestList(source); err == nil { + _, err := ir.ManifestPush(ctx, source, destination, options) + return err } return pushError } diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index f932cf21d..7e5477f4f 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -68,29 +68,17 @@ func (ir *ImageEngine) ManifestInspect(ctx context.Context, name string) ([]byte // inspect foo` wants to do a remote-inspect of foo iff "foo" in the // containers storage is an ordinary image but not a manifest list. - lookupOptions := &libimage.LookupImageOptions{IgnorePlatform: true} - image, _, err := ir.Libpod.LibimageRuntime().LookupImage(name, lookupOptions) + manifestList, err := ir.Libpod.LibimageRuntime().LookupManifestList(name) if err != nil { - // If the image doesn't exist, do a remote inspect. - if errors.Cause(err) == storage.ErrImageUnknown { + switch errors.Cause(err) { + // Do a remote inspect if there's no local image or if the + // local image is not a manifest list. + case storage.ErrImageUnknown, libimage.ErrNotAManifestList: return ir.remoteManifestInspect(ctx, name) - } - return nil, err - } - - isManifestList, err := image.IsManifestList(ctx) - if err != nil { - return nil, err - } - // If the image isn't a manifest list, do a remote inspect. - if !isManifestList { - return ir.remoteManifestInspect(ctx, name) - } - - manifestList, err := image.ToManifestList() - if err != nil { - return nil, err + default: + return nil, err + } } schema2List, err := manifestList.Inspect() @@ -320,6 +308,11 @@ func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (stri return manifestList.ID(), nil } +// ManifestRm removes the specified manifest list from storage +func (ir *ImageEngine) ManifestRm(ctx context.Context, names []string) (report *entities.ImageRemoveReport, rmErrors []error) { + return ir.Remove(ctx, names, entities.ImageRemoveOptions{}) +} + // ManifestPush pushes a manifest list or image index to the destination func (ir *ImageEngine) ManifestPush(ctx context.Context, name, destination string, opts entities.ImagePushOptions) (string, error) { manifestList, err := ir.Libpod.LibimageRuntime().LookupManifestList(name) diff --git a/pkg/domain/infra/tunnel/manifest.go b/pkg/domain/infra/tunnel/manifest.go index 8ac1f1420..b8069405a 100644 --- a/pkg/domain/infra/tunnel/manifest.go +++ b/pkg/domain/infra/tunnel/manifest.go @@ -83,6 +83,11 @@ func (ir *ImageEngine) ManifestRemove(ctx context.Context, names []string) (stri return fmt.Sprintf("%s :%s\n", updatedListID, names[1]), nil } +// ManifestRm removes the specified manifest list from storage +func (ir *ImageEngine) ManifestRm(ctx context.Context, names []string) (*entities.ImageRemoveReport, []error) { + return ir.Remove(ctx, names, entities.ImageRemoveOptions{}) +} + // ManifestPush pushes a manifest list or image index to the destination func (ir *ImageEngine) ManifestPush(ctx context.Context, name, destination string, opts entities.ImagePushOptions) (string, error) { options := new(images.PushOptions) |