Skip to content

Commit

Permalink
Merge pull request containers#3522 from mheon/nix_the_artifact
Browse files Browse the repository at this point in the history
Move the HostConfig portion of Inspect inside libpod
  • Loading branch information
openshift-merge-robot authored Jul 18, 2019
2 parents b2734ba + c91bc31 commit 7488ed6
Show file tree
Hide file tree
Showing 12 changed files with 1,134 additions and 333 deletions.
42 changes: 4 additions & 38 deletions cmd/podman/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ import (

"github.com/containers/buildah/pkg/formats"
"github.com/containers/libpod/cmd/podman/cliconfig"
"github.com/containers/libpod/cmd/podman/shared"
"github.com/containers/libpod/pkg/adapter"
cc "github.com/containers/libpod/pkg/spec"
"github.com/containers/libpod/pkg/util"
"github.com/pkg/errors"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -148,19 +146,9 @@ func iterateInput(ctx context.Context, size bool, args []string, runtime *adapte
inspectError = errors.Wrapf(err, "error looking up container %q", input)
break
}
libpodInspectData, err := ctr.Inspect(size)
data, err = ctr.Inspect(size)
if err != nil {
inspectError = errors.Wrapf(err, "error getting libpod container inspect data %s", ctr.ID())
break
}
artifact, err := getArtifact(ctr)
if inspectError != nil {
inspectError = err
break
}
data, err = shared.GetCtrInspectInfo(ctr.Config(), libpodInspectData, artifact)
if err != nil {
inspectError = errors.Wrapf(err, "error parsing container data %q", ctr.ID())
inspectError = errors.Wrapf(err, "error inspecting container %s", ctr.ID())
break
}
case inspectTypeImage:
Expand Down Expand Up @@ -188,19 +176,9 @@ func iterateInput(ctx context.Context, size bool, args []string, runtime *adapte
break
}
} else {
libpodInspectData, err := ctr.Inspect(size)
if err != nil {
inspectError = errors.Wrapf(err, "error getting libpod container inspect data %s", ctr.ID())
break
}
artifact, err := getArtifact(ctr)
data, err = ctr.Inspect(size)
if err != nil {
inspectError = err
break
}
data, err = shared.GetCtrInspectInfo(ctr.Config(), libpodInspectData, artifact)
if err != nil {
inspectError = errors.Wrapf(err, "error parsing container data %s", ctr.ID())
inspectError = errors.Wrapf(err, "error inspecting container %s", ctr.ID())
break
}
}
Expand All @@ -211,15 +189,3 @@ func iterateInput(ctx context.Context, size bool, args []string, runtime *adapte
}
return inspectedItems, inspectError
}

func getArtifact(ctr *adapter.Container) (*cc.CreateConfig, error) {
var createArtifact cc.CreateConfig
artifact, err := ctr.GetArtifact("create-config")
if err != nil {
return nil, err
}
if err := json.Unmarshal(artifact, &createArtifact); err != nil {
return nil, err
}
return &createArtifact, nil
}
211 changes: 0 additions & 211 deletions cmd/podman/shared/container_inspect.go

This file was deleted.

9 changes: 1 addition & 8 deletions cmd/podman/shared/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
ImageVolumeType: c.String("image-volume"),
CapAdd: c.StringSlice("cap-add"),
CapDrop: c.StringSlice("cap-drop"),
CidFile: c.String("cidfile"),
CgroupParent: c.String("cgroup-parent"),
Command: command,
Detach: c.Bool("detach"),
Expand Down Expand Up @@ -766,14 +767,6 @@ func CreateContainerFromCreateConfig(r *libpod.Runtime, createConfig *cc.CreateC
if err != nil {
return nil, err
}

createConfigJSON, err := json.Marshal(createConfig)
if err != nil {
return nil, err
}
if err := ctr.AddArtifact("create-config", createConfigJSON); err != nil {
return nil, err
}
return ctr, nil
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ require (
github.com/spf13/pflag v1.0.3
github.com/spf13/viper v1.4.0 // indirect
github.com/stretchr/testify v1.3.0
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 // indirect
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2
github.com/tchap/go-patricia v2.3.0+incompatible // indirect
github.com/uber/jaeger-client-go v2.16.0+incompatible
github.com/uber/jaeger-lib v0.0.0-20190122222657-d036253de8f5 // indirect
Expand Down
Loading

0 comments on commit 7488ed6

Please sign in to comment.