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 <bbaude@redhat.com>
This commit is contained in:
baude
2019-04-01 12:50:08 -05:00
parent 2ad5f5cc25
commit 576a80b0d7
9 changed files with 76 additions and 6 deletions

View File

@@ -4,7 +4,7 @@ import (
"fmt"
"github.com/containers/buildah/pkg/formats"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/libpodruntime"
"github.com/containers/libpod/pkg/adapter"
"github.com/containers/storage/pkg/archive"
"github.com/pkg/errors"
"github.com/spf13/cobra"
@@ -86,18 +86,17 @@ func diffCmd(c *cliconfig.DiffValues) error {
return errors.Errorf("container, image, or layer name must be specified: podman diff [options [...]] ID-NAME")
}
runtime, err := libpodruntime.GetRuntime(&c.PodmanCommand)
runtime, err := adapter.GetRuntime(&c.PodmanCommand)
if err != nil {
return errors.Wrapf(err, "could not get runtime")
}
defer runtime.Shutdown(false)
to := c.InputArgs[0]
changes, err := runtime.GetDiff("", to)
changes, err := runtime.Diff(c, to)
if err != nil {
return errors.Wrapf(err, "could not get changes for %q", to)
}
diffOutput := []diffOutputParams{}
outputFormat := c.Format