From 576a80b0d75182a5ae12985c47bd31da72a51bc8 Mon Sep 17 00:00:00 2001 From: baude Date: Mon, 1 Apr 2019 12:50:08 -0500 Subject: add remote-client diff the remote client now can run the diff command to report changes, modifications, and deletions in an image or container. Signed-off-by: baude --- pkg/adapter/runtime_remote.go | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'pkg/adapter/runtime_remote.go') diff --git a/pkg/adapter/runtime_remote.go b/pkg/adapter/runtime_remote.go index dcc2d5aa6..c3a4f322d 100644 --- a/pkg/adapter/runtime_remote.go +++ b/pkg/adapter/runtime_remote.go @@ -831,3 +831,30 @@ func (r *LocalRuntime) Events(c *cliconfig.EventValues) error { } return nil } + +// Diff ... +func (r *LocalRuntime) Diff(c *cliconfig.DiffValues, to string) ([]archive.Change, error) { + var changes []archive.Change + reply, err := iopodman.Diff().Call(r.Conn, to) + if err != nil { + return nil, err + } + for _, change := range reply { + changes = append(changes, archive.Change{Path: change.Path, Kind: stringToChangeType(change.ChangeType)}) + } + return changes, nil +} + +func stringToChangeType(change string) archive.ChangeType { + switch change { + case "A": + return archive.ChangeAdd + case "D": + return archive.ChangeDelete + default: + logrus.Errorf("'%s' is unknown archive type", change) + fallthrough + case "C": + return archive.ChangeModify + } +} -- cgit v1.2.3-54-g00ecf