diff options
author | Suraj Deshmukh <surajd.service@gmail.com> | 2017-11-24 23:01:46 +0530 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2017-11-28 14:30:12 +0000 |
commit | 7eb4772694ed9b522fe688d8bd12a56ab3be751f (patch) | |
tree | 9e3686ca8536a2e93c472afa344ea5e6a446f552 | |
parent | d43f7867282f04d3003c44ee96eb2324c6d2a0aa (diff) | |
download | podman-7eb4772694ed9b522fe688d8bd12a56ab3be751f.tar.gz podman-7eb4772694ed9b522fe688d8bd12a56ab3be751f.tar.bz2 podman-7eb4772694ed9b522fe688d8bd12a56ab3be751f.zip |
remove unused functions and variables
Signed-off-by: Suraj Deshmukh <surajd.service@gmail.com>
Closes: #71
Approved by: rhatdan
-rw-r--r-- | cmd/kpod/common_test.go | 10 | ||||
-rw-r--r-- | cmd/kpod/export.go | 5 | ||||
-rw-r--r-- | libpod/common/common.go | 19 | ||||
-rw-r--r-- | libpod/diff.go | 8 | ||||
-rw-r--r-- | libpod/runtime_img.go | 17 | ||||
-rw-r--r-- | libpod/util.go | 21 |
6 files changed, 21 insertions, 59 deletions
diff --git a/cmd/kpod/common_test.go b/cmd/kpod/common_test.go index 663bc41e1..8a3bfd181 100644 --- a/cmd/kpod/common_test.go +++ b/cmd/kpod/common_test.go @@ -1,7 +1,6 @@ package main import ( - "os/exec" "os/user" "testing" @@ -40,12 +39,3 @@ func skipTestIfNotRoot(t *testing.T) { t.Skip("tests will fail unless run as root") } } - -func pullTestImage(name string) error { - cmd := exec.Command("crioctl", "image", "pull", name) - err := cmd.Run() - if err != nil { - return err - } - return nil -} diff --git a/cmd/kpod/export.go b/cmd/kpod/export.go index aaa4b2803..9b498562e 100644 --- a/cmd/kpod/export.go +++ b/cmd/kpod/export.go @@ -8,11 +8,6 @@ import ( "github.com/urfave/cli" ) -type exportOptions struct { - output string - container string -} - var ( exportFlags = []cli.Flag{ cli.StringFlag{ 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) +} |