remove unused functions and variables

Signed-off-by: Suraj Deshmukh <surajd.service@gmail.com>

Closes: #71
Approved by: rhatdan
This commit is contained in:
Suraj Deshmukh
2017-11-24 23:01:46 +05:30
committed by Atomic Bot
parent d43f786728
commit 7eb4772694
6 changed files with 21 additions and 59 deletions

View File

@ -1,7 +1,6 @@
package main package main
import ( import (
"os/exec"
"os/user" "os/user"
"testing" "testing"
@ -40,12 +39,3 @@ func skipTestIfNotRoot(t *testing.T) {
t.Skip("tests will fail unless run as root") 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
}

View File

@ -8,11 +8,6 @@ import (
"github.com/urfave/cli" "github.com/urfave/cli"
) )
type exportOptions struct {
output string
container string
}
var ( var (
exportFlags = []cli.Flag{ exportFlags = []cli.Flag{
cli.StringFlag{ cli.StringFlag{

View File

@ -6,7 +6,6 @@ import (
"syscall" "syscall"
cp "github.com/containers/image/copy" cp "github.com/containers/image/copy"
"github.com/containers/image/signature"
"github.com/containers/image/types" "github.com/containers/image/types"
"github.com/pkg/errors" "github.com/pkg/errors"
) )
@ -45,15 +44,6 @@ func GetSystemContext(signaturePolicyPath, authFilePath string) *types.SystemCon
return sc 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" // IsTrue determines whether the given string equals "true"
func IsTrue(str string) bool { func IsTrue(str string) bool {
return str == "true" return str == "true"
@ -69,15 +59,6 @@ func IsValidBool(str string) bool {
return IsTrue(str) || IsFalse(str) 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 // ParseRegistryCreds takes a credentials string in the form USERNAME:PASSWORD
// and returns a DockerAuthConfig // and returns a DockerAuthConfig
func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error) { func ParseRegistryCreds(creds string) (*types.DockerAuthConfig, error) {

View File

@ -43,11 +43,3 @@ func (r *Runtime) getLayerID(id string) (string, error) {
} }
return toLayer, nil 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
}

View File

@ -1,7 +1,6 @@
package libpod package libpod
import ( import (
"encoding/json"
"fmt" "fmt"
"io" "io"
"net" "net"
@ -112,7 +111,6 @@ type Image struct {
Name string Name string
ID string ID string
fqname string fqname string
hasImageLocal bool //nolint
runtime *Runtime runtime *Runtime
Registry string Registry string
ImageName string ImageName string
@ -1192,21 +1190,6 @@ func ParseImageNames(names []string) (tags, digests []string, err error) {
return tags, digests, nil 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) { func findImageInSlice(images []storage.Image, ref string) (storage.Image, error) {
for _, image := range images { for _, image := range images {
if MatchesID(image.ID, ref) { if MatchesID(image.ID, ref) {

View File

@ -6,6 +6,9 @@ import (
"path/filepath" "path/filepath"
"strings" "strings"
"time" "time"
"github.com/containers/image/signature"
"github.com/containers/image/types"
) )
// Runtime API constants // Runtime API constants
@ -55,3 +58,21 @@ func FuncTimer(funcName string) {
func hasTransport(image string) bool { func hasTransport(image string) bool {
return strings.Contains(image, "://") 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)
}