aboutsummaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
Diffstat (limited to 'libpod')
-rw-r--r--libpod/common/common.go19
-rw-r--r--libpod/diff.go8
-rw-r--r--libpod/runtime_img.go17
-rw-r--r--libpod/util.go21
4 files changed, 21 insertions, 44 deletions
diff --git a/libpod/common/common.go b/libpod/common/common.go
index 775d391da..8a7fbcd5e 100644
--- a/libpod/common/common.go
+++ b/libpod/common/common.go
@@ -6,7 +6,6 @@ import (
"syscall"
cp "github.com/containers/image/copy"
- "github.com/containers/image/signature"
"github.com/containers/image/types"
"github.com/pkg/errors"
)
@@ -45,15 +44,6 @@ func GetSystemContext(signaturePolicyPath, authFilePath string) *types.SystemCon
return sc
}
-// CopyStringStringMap deep copies a map[string]string and returns the result
-func CopyStringStringMap(m map[string]string) map[string]string {
- n := map[string]string{}
- for k, v := range m {
- n[k] = v
- }
- return n
-}
-
// IsTrue determines whether the given string equals "true"
func IsTrue(str string) bool {
return str == "true"
@@ -69,15 +59,6 @@ func IsValidBool(str string) bool {
return IsTrue(str) || IsFalse(str)
}
-// GetPolicyContext creates a signature policy context for the given signature policy path
-func GetPolicyContext(path string) (*signature.PolicyContext, error) {
- policy, err := signature.DefaultPolicy(&types.SystemContext{SignaturePolicyPath: path})
- if err != nil {
- return nil, err
- }
- return signature.NewPolicyContext(policy)
-}
-
// ParseRegistryCreds takes a credentials string in the form USERNAME:PASSWORD
// and returns a DockerAuthConfig
func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error) {
diff --git a/libpod/diff.go b/libpod/diff.go
index 5dac56a44..3d95a8e41 100644
--- a/libpod/diff.go
+++ b/libpod/diff.go
@@ -43,11 +43,3 @@ func (r *Runtime) getLayerID(id string) (string, error) {
}
return toLayer, nil
}
-
-func (r *Runtime) getLayerParent(layerID string) (string, error) { //nolint
- layer, err := r.store.Layer(layerID)
- if err != nil {
- return "", err
- }
- return layer.Parent, nil
-}
diff --git a/libpod/runtime_img.go b/libpod/runtime_img.go
index 4c81380bb..2b18a5322 100644
--- a/libpod/runtime_img.go
+++ b/libpod/runtime_img.go
@@ -1,7 +1,6 @@
package libpod
import (
- "encoding/json"
"fmt"
"io"
"net"
@@ -112,7 +111,6 @@ type Image struct {
Name string
ID string
fqname string
- hasImageLocal bool //nolint
runtime *Runtime
Registry string
ImageName string
@@ -1192,21 +1190,6 @@ func ParseImageNames(names []string) (tags, digests []string, err error) {
return tags, digests, nil
}
-// Remove nolint when used
-func annotations(manifest []byte, manifestType string) map[string]string { //nolint
- annotations := make(map[string]string)
- switch manifestType {
- case ociv1.MediaTypeImageManifest:
- var m ociv1.Manifest
- if err := json.Unmarshal(manifest, &m); err == nil {
- for k, v := range m.Annotations {
- annotations[k] = v
- }
- }
- }
- return annotations
-}
-
func findImageInSlice(images []storage.Image, ref string) (storage.Image, error) {
for _, image := range images {
if MatchesID(image.ID, ref) {
diff --git a/libpod/util.go b/libpod/util.go
index c8cbfa2fc..61089b525 100644
--- a/libpod/util.go
+++ b/libpod/util.go
@@ -6,6 +6,9 @@ import (
"path/filepath"
"strings"
"time"
+
+ "github.com/containers/image/signature"
+ "github.com/containers/image/types"
)
// Runtime API constants
@@ -55,3 +58,21 @@ func FuncTimer(funcName string) {
func hasTransport(image string) bool {
return strings.Contains(image, "://")
}
+
+// CopyStringStringMap deep copies a map[string]string and returns the result
+func CopyStringStringMap(m map[string]string) map[string]string {
+ n := map[string]string{}
+ for k, v := range m {
+ n[k] = v
+ }
+ return n
+}
+
+// GetPolicyContext creates a signature policy context for the given signature policy path
+func GetPolicyContext(path string) (*signature.PolicyContext, error) {
+ policy, err := signature.DefaultPolicy(&types.SystemContext{SignaturePolicyPath: path})
+ if err != nil {
+ return nil, err
+ }
+ return signature.NewPolicyContext(policy)
+}