summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-03-28 07:06:31 -0700
committerGitHub <noreply@github.com>2019-03-28 07:06:31 -0700
commite7a2eecf5f3975edfb92cd2cacff0d34ef45f808 (patch)
tree5557aaeb6ec27d61b75b1db18dc5e0a4d85c90be /pkg
parent850326cc192444d1c5cfd8ba6e1015f653b41e73 (diff)
parent179a66f1a0a22be66c0346afa8ea3181d5846fb2 (diff)
downloadpodman-e7a2eecf5f3975edfb92cd2cacff0d34ef45f808.tar.gz
podman-e7a2eecf5f3975edfb92cd2cacff0d34ef45f808.tar.bz2
podman-e7a2eecf5f3975edfb92cd2cacff0d34ef45f808.zip
Merge pull request #2760 from mheon/misc_small_changes
Remove ulele/deepcopier in favor of JSON deep copy
Diffstat (limited to 'pkg')
-rw-r--r--pkg/adapter/pods_remote.go5
-rw-r--r--pkg/spec/createconfig.go15
-rw-r--r--pkg/varlinkapi/containers_create.go5
-rw-r--r--pkg/varlinkapi/images.go8
4 files changed, 24 insertions, 9 deletions
diff --git a/pkg/adapter/pods_remote.go b/pkg/adapter/pods_remote.go
index ef8de90a6..4a32607a2 100644
--- a/pkg/adapter/pods_remote.go
+++ b/pkg/adapter/pods_remote.go
@@ -14,7 +14,6 @@ import (
"github.com/containers/libpod/libpod"
"github.com/containers/libpod/pkg/varlinkapi"
"github.com/pkg/errors"
- "github.com/ulule/deepcopier"
)
// Pod ...
@@ -99,7 +98,9 @@ func (r *LocalRuntime) LookupPod(nameOrID string) (*Pod, error) {
// the data of a remotepod data struct
func (p *Pod) Inspect() (*libpod.PodInspect, error) {
config := new(libpod.PodConfig)
- deepcopier.Copy(p.remotepod.config).To(config)
+ if err := libpod.JSONDeepCopy(p.remotepod.config, config); err != nil {
+ return nil, err
+ }
inspectData := libpod.PodInspect{
Config: config,
State: p.remotepod.state,
diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go
index 79a318771..07ae633d1 100644
--- a/pkg/spec/createconfig.go
+++ b/pkg/spec/createconfig.go
@@ -346,8 +346,11 @@ func (c *CreateConfig) GetTmpfsMounts() []spec.Mount {
return m
}
-func (c *CreateConfig) createExitCommand() []string {
- config := c.Runtime.GetConfig()
+func (c *CreateConfig) createExitCommand() ([]string, error) {
+ config, err := c.Runtime.GetConfig()
+ if err != nil {
+ return nil, err
+ }
cmd, _ := os.Executable()
command := []string{cmd,
@@ -372,7 +375,7 @@ func (c *CreateConfig) createExitCommand() []string {
command = append(command, "--rm")
}
- return command
+ return command, nil
}
// GetContainerCreateOptions takes a CreateConfig and returns a slice of CtrCreateOptions
@@ -567,7 +570,11 @@ func (c *CreateConfig) GetContainerCreateOptions(runtime *libpod.Runtime, pod *l
}
// Always use a cleanup process to clean up Podman after termination
- options = append(options, libpod.WithExitCommand(c.createExitCommand()))
+ exitCmd, err := c.createExitCommand()
+ if err != nil {
+ return nil, err
+ }
+ options = append(options, libpod.WithExitCommand(exitCmd))
if c.HealthCheck != nil {
options = append(options, libpod.WithHealthCheck(c.HealthCheck))
diff --git a/pkg/varlinkapi/containers_create.go b/pkg/varlinkapi/containers_create.go
index 6b53b22c6..8990ac001 100644
--- a/pkg/varlinkapi/containers_create.go
+++ b/pkg/varlinkapi/containers_create.go
@@ -22,7 +22,10 @@ import (
// CreateContainer ...
func (i *LibpodAPI) CreateContainer(call iopodman.VarlinkCall, config iopodman.Create) error {
- rtc := i.Runtime.GetConfig()
+ rtc, err := i.Runtime.GetConfig()
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
ctx := getContext()
newImage, err := i.Runtime.ImageRuntime().New(ctx, config.Image, rtc.SignaturePolicyPath, "", os.Stderr, nil, image.SigningOptions{}, false, nil)
diff --git a/pkg/varlinkapi/images.go b/pkg/varlinkapi/images.go
index 210f139ce..23ea24a7a 100644
--- a/pkg/varlinkapi/images.go
+++ b/pkg/varlinkapi/images.go
@@ -514,7 +514,11 @@ func (i *LibpodAPI) Commit(call iopodman.VarlinkCall, name, imageName string, ch
if err != nil {
return call.ReplyContainerNotFound(name, err.Error())
}
- sc := image.GetSystemContext(i.Runtime.GetConfig().SignaturePolicyPath, "", false)
+ rtc, err := i.Runtime.GetConfig()
+ if err != nil {
+ return call.ReplyErrorOccurred(err.Error())
+ }
+ sc := image.GetSystemContext(rtc.SignaturePolicyPath, "", false)
var mimeType string
switch manifestType {
case "oci", "": //nolint
@@ -525,7 +529,7 @@ func (i *LibpodAPI) Commit(call iopodman.VarlinkCall, name, imageName string, ch
return call.ReplyErrorOccurred(fmt.Sprintf("unrecognized image format %q", manifestType))
}
coptions := buildah.CommitOptions{
- SignaturePolicyPath: i.Runtime.GetConfig().SignaturePolicyPath,
+ SignaturePolicyPath: rtc.SignaturePolicyPath,
ReportWriter: nil,
SystemContext: sc,
PreferredManifestType: mimeType,