Fix Id->ID where possible for lint

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh
2020-06-09 20:45:51 -04:00
parent 4bb43b898d
commit 87718c4e67
48 changed files with 267 additions and 267 deletions

View File

@ -18,7 +18,7 @@ var (
Short: "Attach to a running container", Short: "Attach to a running container",
Long: attachDescription, Long: attachDescription,
RunE: attach, RunE: attach,
Args: validate.IdOrLatestArgs, Args: validate.IDOrLatestArgs,
Example: `podman attach ctrID Example: `podman attach ctrID
podman attach 1234 podman attach 1234
podman attach --no-stdin foobar`, podman attach --no-stdin foobar`,
@ -29,7 +29,7 @@ var (
Short: attachCommand.Short, Short: attachCommand.Short,
Long: attachCommand.Long, Long: attachCommand.Long,
RunE: attachCommand.RunE, RunE: attachCommand.RunE,
Args: validate.IdOrLatestArgs, Args: validate.IDOrLatestArgs,
Example: `podman container attach ctrID Example: `podman container attach ctrID
podman container attach 1234 podman container attach 1234
podman container attach --no-stdin foobar`, podman container attach --no-stdin foobar`,

View File

@ -13,7 +13,7 @@ var (
// podman container _diff_ // podman container _diff_
diffCmd = &cobra.Command{ diffCmd = &cobra.Command{
Use: "diff [flags] CONTAINER", Use: "diff [flags] CONTAINER",
Args: validate.IdOrLatestArgs, Args: validate.IDOrLatestArgs,
Short: "Inspect changes on container's file systems", Short: "Inspect changes on container's file systems",
Long: `Displays changes on a container filesystem. The container will be compared to its parent layer.`, Long: `Displays changes on a container filesystem. The container will be compared to its parent layer.`,
RunE: diff, RunE: diff,

View File

@ -84,7 +84,7 @@ func init() {
} }
func exec(cmd *cobra.Command, args []string) error { func exec(cmd *cobra.Command, args []string) error {
var nameOrId string var nameOrID string
if len(args) == 0 && !execOpts.Latest { if len(args) == 0 && !execOpts.Latest {
return errors.New("exec requires the name or ID of a container or the --latest flag") return errors.New("exec requires the name or ID of a container or the --latest flag")
@ -92,7 +92,7 @@ func exec(cmd *cobra.Command, args []string) error {
execOpts.Cmd = args execOpts.Cmd = args
if !execOpts.Latest { if !execOpts.Latest {
execOpts.Cmd = args[1:] execOpts.Cmd = args[1:]
nameOrId = args[0] nameOrID = args[0]
} }
// Validate given environment variables // Validate given environment variables
execOpts.Envs = make(map[string]string) execOpts.Envs = make(map[string]string)
@ -122,12 +122,12 @@ func exec(cmd *cobra.Command, args []string) error {
streams.AttachOutput = true streams.AttachOutput = true
streams.AttachError = true streams.AttachError = true
exitCode, err := registry.ContainerEngine().ContainerExec(registry.GetContext(), nameOrId, execOpts, streams) exitCode, err := registry.ContainerEngine().ContainerExec(registry.GetContext(), nameOrID, execOpts, streams)
registry.SetExitCode(exitCode) registry.SetExitCode(exitCode)
return err return err
} }
id, err := registry.ContainerEngine().ContainerExecDetached(registry.GetContext(), nameOrId, execOpts) id, err := registry.ContainerEngine().ContainerExecDetached(registry.GetContext(), nameOrID, execOpts)
if err != nil { if err != nil {
return err return err
} }

View File

@ -67,7 +67,7 @@ func listFlagSet(flags *pflag.FlagSet) {
flags.BoolVar(&listOpts.Sync, "sync", false, "Sync container state with OCI runtime") flags.BoolVar(&listOpts.Sync, "sync", false, "Sync container state with OCI runtime")
flags.UintVarP(&listOpts.Watch, "watch", "w", 0, "Watch the ps output on an interval in seconds") flags.UintVarP(&listOpts.Watch, "watch", "w", 0, "Watch the ps output on an interval in seconds")
sort := validate.ChoiceValue(&listOpts.Sort, "command", "created", "id", "image", "names", "runningfor", "size", "status") sort := validate.Value(&listOpts.Sort, "command", "created", "id", "image", "names", "runningfor", "size", "status")
flags.Var(sort, "sort", "Sort output by: "+sort.Choices()) flags.Var(sort, "sort", "Sort output by: "+sort.Choices())
if registry.IsRemote() { if registry.IsRemote() {

View File

@ -219,9 +219,9 @@ func combineHumanValues(a, b uint64) string {
func outputJSON(stats []*containerStats) error { func outputJSON(stats []*containerStats) error {
type jstat struct { type jstat struct {
Id string `json:"id"` Id string `json:"id"` //nolint
Name string `json:"name"` Name string `json:"name"`
CpuPercent string `json:"cpu_percent"` CpuPercent string `json:"cpu_percent"` //nolint
MemUsage string `json:"mem_usage"` MemUsage string `json:"mem_usage"`
MemPerc string `json:"mem_percent"` MemPerc string `json:"mem_percent"`
NetIO string `json:"net_io"` NetIO string `json:"net_io"`

View File

@ -23,7 +23,7 @@ var (
Short: "Block on one or more containers", Short: "Block on one or more containers",
Long: waitDescription, Long: waitDescription,
RunE: wait, RunE: wait,
Args: validate.IdOrLatestArgs, Args: validate.IDOrLatestArgs,
Example: `podman wait --interval 5000 ctrID Example: `podman wait --interval 5000 ctrID
podman wait ctrID1 ctrID2`, podman wait ctrID1 ctrID2`,
} }
@ -33,7 +33,7 @@ var (
Short: waitCommand.Short, Short: waitCommand.Short,
Long: waitCommand.Long, Long: waitCommand.Long,
RunE: waitCommand.RunE, RunE: waitCommand.RunE,
Args: validate.IdOrLatestArgs, Args: validate.IDOrLatestArgs,
Example: `podman container wait --interval 5000 ctrID Example: `podman container wait --interval 5000 ctrID
podman container wait ctrID1 ctrID2`, podman container wait ctrID1 ctrID2`,
} }

View File

@ -18,7 +18,7 @@ var (
diffDescription = `Displays changes on a container or image's filesystem. The container or image will be compared to its parent layer.` diffDescription = `Displays changes on a container or image's filesystem. The container or image will be compared to its parent layer.`
diffCmd = &cobra.Command{ diffCmd = &cobra.Command{
Use: "diff [flags] {CONTAINER_ID | IMAGE_ID}", Use: "diff [flags] {CONTAINER_ID | IMAGE_ID}",
Args: validate.IdOrLatestArgs, Args: validate.IDOrLatestArgs,
Short: "Display the changes of object's file system", Short: "Display the changes of object's file system",
Long: diffDescription, Long: diffDescription,
TraverseChildren: true, TraverseChildren: true,

View File

@ -73,8 +73,8 @@ func aliasNetworkFlag(_ *pflag.FlagSet, name string) pflag.NormalizedName {
func create(cmd *cobra.Command, args []string) error { func create(cmd *cobra.Command, args []string) error {
var ( var (
err error err error
podIdFile *os.File podIDFD *os.File
) )
createOptions.Labels, err = parse.GetAllLabels(labelFile, labels) createOptions.Labels, err = parse.GetAllLabels(labelFile, labels)
if err != nil { if err != nil {
@ -101,15 +101,15 @@ func create(cmd *cobra.Command, args []string) error {
} }
if cmd.Flag("pod-id-file").Changed { if cmd.Flag("pod-id-file").Changed {
podIdFile, err = util.OpenExclusiveFile(podIDFile) podIDFD, err = util.OpenExclusiveFile(podIDFile)
if err != nil && os.IsExist(err) { if err != nil && os.IsExist(err) {
return errors.Errorf("pod id file exists. Ensure another pod is not using it or delete %s", podIDFile) return errors.Errorf("pod id file exists. Ensure another pod is not using it or delete %s", podIDFile)
} }
if err != nil { if err != nil {
return errors.Errorf("error opening pod-id-file %s", podIDFile) return errors.Errorf("error opening pod-id-file %s", podIDFile)
} }
defer errorhandling.CloseQuiet(podIdFile) defer errorhandling.CloseQuiet(podIDFD)
defer errorhandling.SyncQuiet(podIdFile) defer errorhandling.SyncQuiet(podIDFD)
} }
createOptions.Net, err = common.NetFlagsToNetOptions(cmd) createOptions.Net, err = common.NetFlagsToNetOptions(cmd)

View File

@ -195,7 +195,7 @@ func (l ListPodReporter) ID() string {
} }
// Id returns the Pod id // Id returns the Pod id
func (l ListPodReporter) Id() string { func (l ListPodReporter) Id() string { //nolint
if noTrunc { if noTrunc {
return l.ListPodsReport.Id return l.ListPodsReport.Id
} }
@ -209,7 +209,7 @@ func (l ListPodReporter) InfraID() string {
// InfraId returns the infra container id for the pod // InfraId returns the infra container id for the pod
// depending on trunc // depending on trunc
func (l ListPodReporter) InfraId() string { func (l ListPodReporter) InfraId() string { //nolint
if len(l.ListPodsReport.InfraId) == 0 { if len(l.ListPodsReport.InfraId) == 0 {
return "" return ""
} }
@ -252,7 +252,7 @@ func sortPodPsOutput(sortBy string, lprs []*entities.ListPodsReport) error {
case "created": case "created":
sort.Sort(podPsSortedCreated{lprs}) sort.Sort(podPsSortedCreated{lprs})
case "id": case "id":
sort.Sort(podPsSortedId{lprs}) sort.Sort(podPsSortedID{lprs})
case "name": case "name":
sort.Sort(podPsSortedName{lprs}) sort.Sort(podPsSortedName{lprs})
case "number": case "number":
@ -276,9 +276,9 @@ func (a podPsSortedCreated) Less(i, j int) bool {
return a.lprSort[i].Created.After(a.lprSort[j].Created) return a.lprSort[i].Created.After(a.lprSort[j].Created)
} }
type podPsSortedId struct{ lprSort } type podPsSortedID struct{ lprSort }
func (a podPsSortedId) Less(i, j int) bool { return a.lprSort[i].Id < a.lprSort[j].Id } func (a podPsSortedID) Less(i, j int) bool { return a.lprSort[i].Id < a.lprSort[j].Id }
type podPsSortedNumber struct{ lprSort } type podPsSortedNumber struct{ lprSort }

View File

@ -23,8 +23,8 @@ func SubCommandExists(cmd *cobra.Command, args []string) error {
return errors.Errorf("missing command '%[1]s COMMAND'\nTry '%[1]s --help' for more information.", cmd.CommandPath()) return errors.Errorf("missing command '%[1]s COMMAND'\nTry '%[1]s --help' for more information.", cmd.CommandPath())
} }
// IdOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag // IDOrLatestArgs used to validate a nameOrId was provided or the "--latest" flag
func IdOrLatestArgs(cmd *cobra.Command, args []string) error { func IDOrLatestArgs(cmd *cobra.Command, args []string) error {
if len(args) > 1 || (len(args) == 0 && !cmd.Flag("latest").Changed) { if len(args) > 1 || (len(args) == 0 && !cmd.Flag("latest").Changed) {
return fmt.Errorf("`%s` requires a name, id or the \"--latest\" flag", cmd.CommandPath()) return fmt.Errorf("`%s` requires a name, id or the \"--latest\" flag", cmd.CommandPath())
} }

View File

@ -6,28 +6,28 @@ import (
) )
// Honors cobra.Value interface // Honors cobra.Value interface
type choiceValue struct { type ChoiceValue struct {
value *string value *string
choices []string choices []string
} }
// ChoiceValue may be used in cobra FlagSet methods Var/VarP/VarPF() to select from a set of values // Value may be used in cobra FlagSet methods Var/VarP/VarPF() to select from a set of values
// //
// Example: // Example:
// created := validate.ChoiceValue(&opts.Sort, "command", "created", "id", "image", "names", "runningfor", "size", "status") // created := validate.ChoiceValue(&opts.Sort, "command", "created", "id", "image", "names", "runningfor", "size", "status")
// flags.Var(created, "sort", "Sort output by: "+created.Choices()) // flags.Var(created, "sort", "Sort output by: "+created.Choices())
func ChoiceValue(p *string, choices ...string) *choiceValue { func Value(p *string, choices ...string) *ChoiceValue {
return &choiceValue{ return &ChoiceValue{
value: p, value: p,
choices: choices, choices: choices,
} }
} }
func (c *choiceValue) String() string { func (c *ChoiceValue) String() string {
return *c.value return *c.value
} }
func (c *choiceValue) Set(value string) error { func (c *ChoiceValue) Set(value string) error {
for _, v := range c.choices { for _, v := range c.choices {
if v == value { if v == value {
*c.value = value *c.value = value
@ -37,10 +37,10 @@ func (c *choiceValue) Set(value string) error {
return fmt.Errorf("%q is not a valid value. Choose from: %q", value, c.Choices()) return fmt.Errorf("%q is not a valid value. Choose from: %q", value, c.Choices())
} }
func (c *choiceValue) Choices() string { func (c *ChoiceValue) Choices() string {
return strings.Join(c.choices, ", ") return strings.Join(c.choices, ", ")
} }
func (c *choiceValue) Type() string { func (c *ChoiceValue) Type() string {
return "choice" return "choice"
} }

View File

@ -67,6 +67,6 @@ func create(cmd *cobra.Command, args []string) error {
if err != nil { if err != nil {
return err return err
} }
fmt.Println(response.IdOrName) fmt.Println(response.IDOrName)
return nil return nil
} }

View File

@ -348,7 +348,7 @@ func LogsFromContainer(w http.ResponseWriter, r *http.Request) {
} }
func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error) { func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error) {
imageId, imageName := l.Image() imageID, imageName := l.Image()
var ( var (
err error err error
@ -378,7 +378,7 @@ func LibpodToContainer(l *libpod.Container, sz bool) (*handlers.Container, error
ID: l.ID(), ID: l.ID(),
Names: []string{fmt.Sprintf("/%s", l.Name())}, Names: []string{fmt.Sprintf("/%s", l.Name())},
Image: imageName, Image: imageName,
ImageID: imageId, ImageID: imageID,
Command: strings.Join(l.Command(), " "), Command: strings.Join(l.Command(), " "),
Created: l.CreatedTime().Unix(), Created: l.CreatedTime().Unix(),
Ports: nil, Ports: nil,

View File

@ -224,7 +224,7 @@ func CreateImageFromSrc(w http.ResponseWriter, r *http.Request) {
Status string `json:"status"` Status string `json:"status"`
Progress string `json:"progress"` Progress string `json:"progress"`
ProgressDetail map[string]string `json:"progressDetail"` ProgressDetail map[string]string `json:"progressDetail"`
Id string `json:"id"` Id string `json:"id"` //nolint
}{ }{
Status: iid, Status: iid,
ProgressDetail: map[string]string{}, ProgressDetail: map[string]string{},
@ -289,7 +289,7 @@ func CreateImageFromImage(w http.ResponseWriter, r *http.Request) {
Error string `json:"error"` Error string `json:"error"`
Progress string `json:"progress"` Progress string `json:"progress"`
ProgressDetail map[string]string `json:"progressDetail"` ProgressDetail map[string]string `json:"progressDetail"`
Id string `json:"id"` Id string `json:"id"` //nolint
}{ }{
Status: fmt.Sprintf("pulling image (%s) from %s", img.Tag, strings.Join(img.Names(), ", ")), Status: fmt.Sprintf("pulling image (%s) from %s", img.Tag, strings.Join(img.Names(), ", ")),
ProgressDetail: map[string]string{}, ProgressDetail: map[string]string{},

View File

@ -59,10 +59,10 @@ func BuildImage(w http.ResponseWriter, r *http.Request) {
ForceRm bool `schema:"forcerm"` ForceRm bool `schema:"forcerm"`
Memory int64 `schema:"memory"` Memory int64 `schema:"memory"`
MemSwap int64 `schema:"memswap"` MemSwap int64 `schema:"memswap"`
CpuShares uint64 `schema:"cpushares"` CpuShares uint64 `schema:"cpushares"` //nolint
CpuSetCpus string `schema:"cpusetcpus"` CpuSetCpus string `schema:"cpusetcpus"` //nolint
CpuPeriod uint64 `schema:"cpuperiod"` CpuPeriod uint64 `schema:"cpuperiod"` //nolint
CpuQuota int64 `schema:"cpuquota"` CpuQuota int64 `schema:"cpuquota"` //nolint
BuildArgs string `schema:"buildargs"` BuildArgs string `schema:"buildargs"`
ShmSize int `schema:"shmsize"` ShmSize int `schema:"shmsize"`
Squash bool `schema:"squash"` Squash bool `schema:"squash"`

View File

@ -14,13 +14,13 @@ import (
// Clients will use the Header availability to test which backend engine is in use. // Clients will use the Header availability to test which backend engine is in use.
// Note: Additionally handler supports GET and HEAD methods // Note: Additionally handler supports GET and HEAD methods
func Ping(w http.ResponseWriter, r *http.Request) { func Ping(w http.ResponseWriter, r *http.Request) {
w.Header().Set("API-Version", utils.ApiVersion[utils.CompatTree][utils.CurrentApiVersion].String()) w.Header().Set("API-Version", utils.APIVersion[utils.CompatTree][utils.CurrentAPIVersion].String())
w.Header().Set("BuildKit-Version", "") w.Header().Set("BuildKit-Version", "")
w.Header().Set("Docker-Experimental", "true") w.Header().Set("Docker-Experimental", "true")
w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Cache-Control", "no-cache")
w.Header().Set("Pragma", "no-cache") w.Header().Set("Pragma", "no-cache")
w.Header().Set("Libpod-API-Version", utils.ApiVersion[utils.LibpodTree][utils.CurrentApiVersion].String()) w.Header().Set("Libpod-API-Version", utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String())
w.Header().Set("Libpod-Buildha-Version", buildah.Version) w.Header().Set("Libpod-Buildha-Version", buildah.Version)
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)

View File

@ -34,14 +34,14 @@ func VersionHandler(w http.ResponseWriter, r *http.Request) {
Name: "Podman Engine", Name: "Podman Engine",
Version: versionInfo.Version, Version: versionInfo.Version,
Details: map[string]string{ Details: map[string]string{
"APIVersion": utils.ApiVersion[utils.LibpodTree][utils.CurrentApiVersion].String(), "APIVersion": utils.APIVersion[utils.LibpodTree][utils.CurrentAPIVersion].String(),
"Arch": goRuntime.GOARCH, "Arch": goRuntime.GOARCH,
"BuildTime": time.Unix(versionInfo.Built, 0).Format(time.RFC3339), "BuildTime": time.Unix(versionInfo.Built, 0).Format(time.RFC3339),
"Experimental": "true", "Experimental": "true",
"GitCommit": versionInfo.GitCommit, "GitCommit": versionInfo.GitCommit,
"GoVersion": versionInfo.GoVersion, "GoVersion": versionInfo.GoVersion,
"KernelVersion": infoData.Host.Kernel, "KernelVersion": infoData.Host.Kernel,
"MinAPIVersion": utils.ApiVersion[utils.LibpodTree][utils.MinimalApiVersion].String(), "MinAPIVersion": utils.APIVersion[utils.LibpodTree][utils.MinimalAPIVersion].String(),
"Os": goRuntime.GOOS, "Os": goRuntime.GOOS,
}, },
}} }}

View File

@ -17,7 +17,7 @@ func NewAPIDecoder() *schema.Decoder {
d := schema.NewDecoder() d := schema.NewDecoder()
d.IgnoreUnknownKeys(true) d.IgnoreUnknownKeys(true)
d.RegisterConverter(map[string][]string{}, convertUrlValuesString) d.RegisterConverter(map[string][]string{}, convertURLValuesString)
d.RegisterConverter(time.Time{}, convertTimeString) d.RegisterConverter(time.Time{}, convertTimeString)
var Signal syscall.Signal var Signal syscall.Signal
@ -35,12 +35,12 @@ func NewAPIDecoder() *schema.Decoder {
// panic(err) // panic(err)
// } // }
// payload = url.QueryEscape(payload) // payload = url.QueryEscape(payload)
func convertUrlValuesString(query string) reflect.Value { func convertURLValuesString(query string) reflect.Value {
f := map[string][]string{} f := map[string][]string{}
err := json.Unmarshal([]byte(query), &f) err := json.Unmarshal([]byte(query), &f)
if err != nil { if err != nil {
logrus.Infof("convertUrlValuesString: Failed to Unmarshal %s: %s", query, err.Error()) logrus.Infof("convertURLValuesString: Failed to Unmarshal %s: %s", query, err.Error())
} }
return reflect.ValueOf(f) return reflect.ValueOf(f)

View File

@ -28,27 +28,27 @@ const (
// CompatTree supports Libpod endpoints // CompatTree supports Libpod endpoints
CompatTree CompatTree
// CurrentApiVersion announces what is the current API level // CurrentAPIVersion announces what is the current API level
CurrentApiVersion = VersionLevel(iota) CurrentAPIVersion = VersionLevel(iota)
// MinimalApiVersion announces what is the oldest API level supported // MinimalAPIVersion announces what is the oldest API level supported
MinimalApiVersion MinimalAPIVersion
) )
var ( var (
// See https://docs.docker.com/engine/api/v1.40/ // See https://docs.docker.com/engine/api/v1.40/
// libpod compat handlers are expected to honor docker API versions // libpod compat handlers are expected to honor docker API versions
// ApiVersion provides the current and minimal API versions for compat and libpod endpoint trees // APIVersion provides the current and minimal API versions for compat and libpod endpoint trees
// Note: GET|HEAD /_ping is never versioned and provides the API-Version and Libpod-API-Version headers to allow // Note: GET|HEAD /_ping is never versioned and provides the API-Version and Libpod-API-Version headers to allow
// clients to shop for the Version they wish to support // clients to shop for the Version they wish to support
ApiVersion = map[VersionTree]map[VersionLevel]semver.Version{ APIVersion = map[VersionTree]map[VersionLevel]semver.Version{
LibpodTree: { LibpodTree: {
CurrentApiVersion: semver.MustParse("1.0.0"), CurrentAPIVersion: semver.MustParse("1.0.0"),
MinimalApiVersion: semver.MustParse("1.0.0"), MinimalAPIVersion: semver.MustParse("1.0.0"),
}, },
CompatTree: { CompatTree: {
CurrentApiVersion: semver.MustParse("1.40.0"), CurrentAPIVersion: semver.MustParse("1.40.0"),
MinimalApiVersion: semver.MustParse("1.24.0"), MinimalAPIVersion: semver.MustParse("1.24.0"),
}, },
} }
@ -103,8 +103,8 @@ func SupportedVersionWithDefaults(r *http.Request) (semver.Version, error) {
} }
return SupportedVersion(r, return SupportedVersion(r,
fmt.Sprintf(">=%s <=%s", ApiVersion[tree][MinimalApiVersion].String(), fmt.Sprintf(">=%s <=%s", APIVersion[tree][MinimalAPIVersion].String(),
ApiVersion[tree][CurrentApiVersion].String())) APIVersion[tree][CurrentAPIVersion].String()))
} }
// WriteResponse encodes the given value as JSON or string and renders it for http client // WriteResponse encodes the given value as JSON or string and renders it for http client

View File

@ -12,12 +12,12 @@ import (
func TestSupportedVersion(t *testing.T) { func TestSupportedVersion(t *testing.T) {
req, err := http.NewRequest("GET", req, err := http.NewRequest("GET",
fmt.Sprintf("/v%s/libpod/testing/versions", ApiVersion[LibpodTree][CurrentApiVersion]), fmt.Sprintf("/v%s/libpod/testing/versions", APIVersion[LibpodTree][CurrentAPIVersion]),
nil) nil)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
req = mux.SetURLVars(req, map[string]string{"version": ApiVersion[LibpodTree][CurrentApiVersion].String()}) req = mux.SetURLVars(req, map[string]string{"version": APIVersion[LibpodTree][CurrentAPIVersion].String()})
rr := httptest.NewRecorder() rr := httptest.NewRecorder()
handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { handler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

View File

@ -54,7 +54,7 @@ func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport
if err != nil { if err != nil {
return nil, err return nil, err
} }
infraId, err := pod.InfraContainerID() infraID, err := pod.InfraContainerID()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -65,7 +65,7 @@ func GetPods(w http.ResponseWriter, r *http.Request) ([]*entities.ListPodsReport
Name: pod.Name(), Name: pod.Name(),
Namespace: pod.Namespace(), Namespace: pod.Namespace(),
Status: status, Status: status,
InfraId: infraId, InfraId: infraID,
Labels: pod.Labels(), Labels: pod.Labels(),
} }
for _, ctr := range ctrs { for _, ctr := range ctrs {

View File

@ -25,7 +25,7 @@ import (
) )
// Attach attaches to a running container // Attach attaches to a running container
func Attach(ctx context.Context, nameOrId string, detachKeys *string, logs, stream *bool, stdin io.Reader, stdout io.Writer, stderr io.Writer, attachReady chan bool) error { func Attach(ctx context.Context, nameOrID string, detachKeys *string, logs, stream *bool, stdin io.Reader, stdout io.Writer, stderr io.Writer, attachReady chan bool) error {
isSet := struct { isSet := struct {
stdin bool stdin bool
stdout bool stdout bool
@ -52,7 +52,7 @@ func Attach(ctx context.Context, nameOrId string, detachKeys *string, logs, stre
} }
// Do we need to wire in stdin? // Do we need to wire in stdin?
ctnr, err := Inspect(ctx, nameOrId, bindings.PFalse) ctnr, err := Inspect(ctx, nameOrID, bindings.PFalse)
if err != nil { if err != nil {
return err return err
} }
@ -115,7 +115,7 @@ func Attach(ctx context.Context, nameOrId string, detachKeys *string, logs, stre
IdleConnTimeout: time.Duration(0), IdleConnTimeout: time.Duration(0),
} }
conn.Client.Transport = t conn.Client.Transport = t
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/attach", params, headers, nameOrId) response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/attach", params, headers, nameOrID)
if err != nil { if err != nil {
return err return err
} }
@ -129,7 +129,7 @@ func Attach(ctx context.Context, nameOrId string, detachKeys *string, logs, stre
winCtx, winCancel := context.WithCancel(ctx) winCtx, winCancel := context.WithCancel(ctx)
defer winCancel() defer winCancel()
go attachHandleResize(ctx, winCtx, winChange, false, nameOrId, file) go attachHandleResize(ctx, winCtx, winChange, false, nameOrID, file)
} }
// If we are attaching around a start, we need to "signal" // If we are attaching around a start, we need to "signal"
@ -243,13 +243,13 @@ func DemuxFrame(r io.Reader, buffer []byte, length int) (frame []byte, err error
} }
// ResizeContainerTTY sets container's TTY height and width in characters // ResizeContainerTTY sets container's TTY height and width in characters
func ResizeContainerTTY(ctx context.Context, nameOrId string, height *int, width *int) error { func ResizeContainerTTY(ctx context.Context, nameOrID string, height *int, width *int) error {
return resizeTTY(ctx, bindings.JoinURL("containers", nameOrId, "resize"), height, width) return resizeTTY(ctx, bindings.JoinURL("containers", nameOrID, "resize"), height, width)
} }
// ResizeExecTTY sets session's TTY height and width in characters // ResizeExecTTY sets session's TTY height and width in characters
func ResizeExecTTY(ctx context.Context, nameOrId string, height *int, width *int) error { func ResizeExecTTY(ctx context.Context, nameOrID string, height *int, width *int) error {
return resizeTTY(ctx, bindings.JoinURL("exec", nameOrId, "resize"), height, width) return resizeTTY(ctx, bindings.JoinURL("exec", nameOrID, "resize"), height, width)
} }
// resizeTTY set size of TTY of container // resizeTTY set size of TTY of container

View File

@ -10,9 +10,9 @@ import (
"github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/domain/entities"
) )
// Checkpoint checkpoints the given container (identified by nameOrId). All additional // Checkpoint checkpoints the given container (identified by nameOrID). All additional
// options are options and allow for more fine grained control of the checkpoint process. // options are options and allow for more fine grained control of the checkpoint process.
func Checkpoint(ctx context.Context, nameOrId string, keep, leaveRunning, tcpEstablished, ignoreRootFS *bool, export *string) (*entities.CheckpointReport, error) { func Checkpoint(ctx context.Context, nameOrID string, keep, leaveRunning, tcpEstablished, ignoreRootFS *bool, export *string) (*entities.CheckpointReport, error) {
var report entities.CheckpointReport var report entities.CheckpointReport
conn, err := bindings.GetClient(ctx) conn, err := bindings.GetClient(ctx)
if err != nil { if err != nil {
@ -34,16 +34,16 @@ func Checkpoint(ctx context.Context, nameOrId string, keep, leaveRunning, tcpEst
if export != nil { if export != nil {
params.Set("export", *export) params.Set("export", *export)
} }
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/checkpoint", params, nil, nameOrId) response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/checkpoint", params, nil, nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &report, response.Process(&report) return &report, response.Process(&report)
} }
// Restore restores a checkpointed container to running. The container is identified by the nameOrId option. All // Restore restores a checkpointed container to running. The container is identified by the nameOrID option. All
// additional options are optional and allow finer control of the restore processs. // additional options are optional and allow finer control of the restore processs.
func Restore(ctx context.Context, nameOrId string, keep, tcpEstablished, ignoreRootFS, ignoreStaticIP, ignoreStaticMAC *bool, name, importArchive *string) (*entities.RestoreReport, error) { func Restore(ctx context.Context, nameOrID string, keep, tcpEstablished, ignoreRootFS, ignoreStaticIP, ignoreStaticMAC *bool, name, importArchive *string) (*entities.RestoreReport, error) {
var report entities.RestoreReport var report entities.RestoreReport
conn, err := bindings.GetClient(ctx) conn, err := bindings.GetClient(ctx)
if err != nil { if err != nil {
@ -71,7 +71,7 @@ func Restore(ctx context.Context, nameOrId string, keep, tcpEstablished, ignoreR
if importArchive != nil { if importArchive != nil {
params.Set("import", *importArchive) params.Set("import", *importArchive)
} }
response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/restore", params, nil, nameOrId) response, err := conn.DoRequest(nil, http.MethodPost, "/containers/%s/restore", params, nil, nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -10,16 +10,16 @@ import (
"github.com/containers/libpod/pkg/bindings" "github.com/containers/libpod/pkg/bindings"
) )
// Commit creates a container image from a container. The container is defined by nameOrId. Use // Commit creates a container image from a container. The container is defined by nameOrID. Use
// the CommitOptions for finer grain control on characteristics of the resulting image. // the CommitOptions for finer grain control on characteristics of the resulting image.
func Commit(ctx context.Context, nameOrId string, options CommitOptions) (handlers.IDResponse, error) { func Commit(ctx context.Context, nameOrID string, options CommitOptions) (handlers.IDResponse, error) {
id := handlers.IDResponse{} id := handlers.IDResponse{}
conn, err := bindings.GetClient(ctx) conn, err := bindings.GetClient(ctx)
if err != nil { if err != nil {
return id, err return id, err
} }
params := url.Values{} params := url.Values{}
params.Set("container", nameOrId) params.Set("container", nameOrID)
if options.Author != nil { if options.Author != nil {
params.Set("author", *options.Author) params.Set("author", *options.Author)
} }

View File

@ -9,13 +9,13 @@ import (
) )
// Diff provides the changes between two container layers // Diff provides the changes between two container layers
func Diff(ctx context.Context, nameOrId string) ([]archive.Change, error) { func Diff(ctx context.Context, nameOrID string) ([]archive.Change, error) {
conn, err := bindings.GetClient(ctx) conn, err := bindings.GetClient(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
response, err := conn.DoRequest(nil, http.MethodGet, "/containers/%s/changes", nil, nil, nameOrId) response, err := conn.DoRequest(nil, http.MethodGet, "/containers/%s/changes", nil, nil, nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -9,13 +9,13 @@ import (
) )
// Diff provides the changes between two container layers // Diff provides the changes between two container layers
func Diff(ctx context.Context, nameOrId string) ([]archive.Change, error) { func Diff(ctx context.Context, nameOrID string) ([]archive.Change, error) {
conn, err := bindings.GetClient(ctx) conn, err := bindings.GetClient(ctx)
if err != nil { if err != nil {
return nil, err return nil, err
} }
response, err := conn.DoRequest(nil, http.MethodGet, "/images/%s/changes", nil, nil, nameOrId) response, err := conn.DoRequest(nil, http.MethodGet, "/images/%s/changes", nil, nil, nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -80,7 +80,7 @@ func GetImage(ctx context.Context, nameOrID string, size *bool) (*entities.Image
} }
// Tree retrieves a "tree" based representation of the given image // Tree retrieves a "tree" based representation of the given image
func Tree(ctx context.Context, nameOrId string, whatRequires *bool) (*entities.ImageTreeReport, error) { func Tree(ctx context.Context, nameOrID string, whatRequires *bool) (*entities.ImageTreeReport, error) {
var report entities.ImageTreeReport var report entities.ImageTreeReport
conn, err := bindings.GetClient(ctx) conn, err := bindings.GetClient(ctx)
if err != nil { if err != nil {
@ -90,7 +90,7 @@ func Tree(ctx context.Context, nameOrId string, whatRequires *bool) (*entities.I
if whatRequires != nil { if whatRequires != nil {
params.Set("size", strconv.FormatBool(*whatRequires)) params.Set("size", strconv.FormatBool(*whatRequires))
} }
response, err := conn.DoRequest(nil, http.MethodGet, "/images/%s/tree", params, nil, nameOrId) response, err := conn.DoRequest(nil, http.MethodGet, "/images/%s/tree", params, nil, nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -85,9 +85,9 @@ func (a psSortedCommand) Less(i, j int) bool {
return strings.Join(a.SortListContainers[i].Command, " ") < strings.Join(a.SortListContainers[j].Command, " ") return strings.Join(a.SortListContainers[i].Command, " ") < strings.Join(a.SortListContainers[j].Command, " ")
} }
type psSortedId struct{ SortListContainers } type psSortedID struct{ SortListContainers }
func (a psSortedId) Less(i, j int) bool { func (a psSortedID) Less(i, j int) bool {
return a.SortListContainers[i].ID < a.SortListContainers[j].ID return a.SortListContainers[i].ID < a.SortListContainers[j].ID
} }
@ -139,7 +139,7 @@ func (a PsSortedCreateTime) Less(i, j int) bool {
func SortPsOutput(sortBy string, psOutput SortListContainers) (SortListContainers, error) { func SortPsOutput(sortBy string, psOutput SortListContainers) (SortListContainers, error) {
switch sortBy { switch sortBy {
case "id": case "id":
sort.Sort(psSortedId{psOutput}) sort.Sort(psSortedID{psOutput})
case "image": case "image":
sort.Sort(psSortedImage{psOutput}) sort.Sort(psSortedImage{psOutput})
case "command": case "command":

View File

@ -56,7 +56,7 @@ type WaitOptions struct {
} }
type WaitReport struct { type WaitReport struct {
Id string Id string //nolint
Error error Error error
ExitCode int32 ExitCode int32
} }
@ -76,7 +76,7 @@ type PauseUnPauseOptions struct {
type PauseUnpauseReport struct { type PauseUnpauseReport struct {
Err error Err error
Id string Id string //nolint
} }
type StopOptions struct { type StopOptions struct {
@ -89,7 +89,7 @@ type StopOptions struct {
type StopReport struct { type StopReport struct {
Err error Err error
Id string Id string //nolint
} }
type TopOptions struct { type TopOptions struct {
@ -110,7 +110,7 @@ type KillOptions struct {
type KillReport struct { type KillReport struct {
Err error Err error
Id string Id string //nolint
} }
type RestartOptions struct { type RestartOptions struct {
@ -122,7 +122,7 @@ type RestartOptions struct {
type RestartReport struct { type RestartReport struct {
Err error Err error
Id string Id string //nolint
} }
type RmOptions struct { type RmOptions struct {
@ -137,7 +137,7 @@ type RmOptions struct {
type RmReport struct { type RmReport struct {
Err error Err error
Id string Id string //nolint
} }
type ContainerInspectReport struct { type ContainerInspectReport struct {
@ -157,7 +157,7 @@ type CommitOptions struct {
} }
type CommitReport struct { type CommitReport struct {
Id string Id string //nolint
} }
type ContainerExportOptions struct { type ContainerExportOptions struct {
@ -176,7 +176,7 @@ type CheckpointOptions struct {
type CheckpointReport struct { type CheckpointReport struct {
Err error Err error
Id string Id string //nolint
} }
type RestoreOptions struct { type RestoreOptions struct {
@ -193,11 +193,11 @@ type RestoreOptions struct {
type RestoreReport struct { type RestoreReport struct {
Err error Err error
Id string Id string //nolint
} }
type ContainerCreateReport struct { type ContainerCreateReport struct {
Id string Id string //nolint
} }
// AttachOptions describes the cli and other values // AttachOptions describes the cli and other values
@ -263,7 +263,7 @@ type ContainerStartOptions struct {
// ContainerStartReport describes the response from starting // ContainerStartReport describes the response from starting
// containers from the cli // containers from the cli
type ContainerStartReport struct { type ContainerStartReport struct {
Id string Id string //nolint
RawInput string RawInput string
Err error Err error
ExitCode int ExitCode int
@ -303,7 +303,7 @@ type ContainerRunOptions struct {
// a container // a container
type ContainerRunReport struct { type ContainerRunReport struct {
ExitCode int ExitCode int
Id string Id string //nolint
} }
// ContainerCleanupOptions are the CLI values for the // ContainerCleanupOptions are the CLI values for the
@ -320,7 +320,7 @@ type ContainerCleanupOptions struct {
// container cleanup // container cleanup
type ContainerCleanupReport struct { type ContainerCleanupReport struct {
CleanErr error CleanErr error
Id string Id string //nolint
RmErr error RmErr error
RmiErr error RmiErr error
} }
@ -336,7 +336,7 @@ type ContainerInitOptions struct {
// container init // container init
type ContainerInitReport struct { type ContainerInitReport struct {
Err error Err error
Id string Id string //nolint
} }
//ContainerMountOptions describes the input values for mounting containers //ContainerMountOptions describes the input values for mounting containers
@ -358,7 +358,7 @@ type ContainerUnmountOptions struct {
// ContainerMountReport describes the response from container mount // ContainerMountReport describes the response from container mount
type ContainerMountReport struct { type ContainerMountReport struct {
Err error Err error
Id string Id string //nolint
Name string Name string
Path string Path string
} }
@ -366,7 +366,7 @@ type ContainerMountReport struct {
// ContainerUnmountReport describes the response from umounting a container // ContainerUnmountReport describes the response from umounting a container
type ContainerUnmountReport struct { type ContainerUnmountReport struct {
Err error Err error
Id string Id string //nolint
} }
// ContainerPruneOptions describes the options needed // ContainerPruneOptions describes the options needed
@ -392,7 +392,7 @@ type ContainerPortOptions struct {
// ContainerPortReport describes the output needed for // ContainerPortReport describes the output needed for
// the CLI to output ports // the CLI to output ports
type ContainerPortReport struct { type ContainerPortReport struct {
Id string Id string //nolint
Ports []ocicni.PortMapping Ports []ocicni.PortMapping
} }

View File

@ -12,25 +12,25 @@ import (
type ContainerEngine interface { type ContainerEngine interface {
AutoUpdate(ctx context.Context, options AutoUpdateOptions) (*AutoUpdateReport, []error) AutoUpdate(ctx context.Context, options AutoUpdateOptions) (*AutoUpdateReport, []error)
Config(ctx context.Context) (*config.Config, error) Config(ctx context.Context) (*config.Config, error)
ContainerAttach(ctx context.Context, nameOrId string, options AttachOptions) error ContainerAttach(ctx context.Context, nameOrID string, options AttachOptions) error
ContainerCheckpoint(ctx context.Context, namesOrIds []string, options CheckpointOptions) ([]*CheckpointReport, error) ContainerCheckpoint(ctx context.Context, namesOrIds []string, options CheckpointOptions) ([]*CheckpointReport, error)
ContainerCleanup(ctx context.Context, namesOrIds []string, options ContainerCleanupOptions) ([]*ContainerCleanupReport, error) ContainerCleanup(ctx context.Context, namesOrIds []string, options ContainerCleanupOptions) ([]*ContainerCleanupReport, error)
ContainerCommit(ctx context.Context, nameOrId string, options CommitOptions) (*CommitReport, error) ContainerCommit(ctx context.Context, nameOrID string, options CommitOptions) (*CommitReport, error)
ContainerCp(ctx context.Context, source, dest string, options ContainerCpOptions) (*ContainerCpReport, error) ContainerCp(ctx context.Context, source, dest string, options ContainerCpOptions) (*ContainerCpReport, error)
ContainerCreate(ctx context.Context, s *specgen.SpecGenerator) (*ContainerCreateReport, error) ContainerCreate(ctx context.Context, s *specgen.SpecGenerator) (*ContainerCreateReport, error)
ContainerDiff(ctx context.Context, nameOrId string, options DiffOptions) (*DiffReport, error) ContainerDiff(ctx context.Context, nameOrID string, options DiffOptions) (*DiffReport, error)
ContainerExec(ctx context.Context, nameOrId string, options ExecOptions, streams define.AttachStreams) (int, error) ContainerExec(ctx context.Context, nameOrID string, options ExecOptions, streams define.AttachStreams) (int, error)
ContainerExecDetached(ctx context.Context, nameOrID string, options ExecOptions) (string, error) ContainerExecDetached(ctx context.Context, nameOrID string, options ExecOptions) (string, error)
ContainerExists(ctx context.Context, nameOrId string) (*BoolReport, error) ContainerExists(ctx context.Context, nameOrID string) (*BoolReport, error)
ContainerExport(ctx context.Context, nameOrId string, options ContainerExportOptions) error ContainerExport(ctx context.Context, nameOrID string, options ContainerExportOptions) error
ContainerInit(ctx context.Context, namesOrIds []string, options ContainerInitOptions) ([]*ContainerInitReport, error) ContainerInit(ctx context.Context, namesOrIds []string, options ContainerInitOptions) ([]*ContainerInitReport, error)
ContainerInspect(ctx context.Context, namesOrIds []string, options InspectOptions) ([]*ContainerInspectReport, error) ContainerInspect(ctx context.Context, namesOrIds []string, options InspectOptions) ([]*ContainerInspectReport, error)
ContainerKill(ctx context.Context, namesOrIds []string, options KillOptions) ([]*KillReport, error) ContainerKill(ctx context.Context, namesOrIds []string, options KillOptions) ([]*KillReport, error)
ContainerList(ctx context.Context, options ContainerListOptions) ([]ListContainer, error) ContainerList(ctx context.Context, options ContainerListOptions) ([]ListContainer, error)
ContainerLogs(ctx context.Context, containers []string, options ContainerLogsOptions) error ContainerLogs(ctx context.Context, containers []string, options ContainerLogsOptions) error
ContainerMount(ctx context.Context, nameOrIds []string, options ContainerMountOptions) ([]*ContainerMountReport, error) ContainerMount(ctx context.Context, nameOrIDs []string, options ContainerMountOptions) ([]*ContainerMountReport, error)
ContainerPause(ctx context.Context, namesOrIds []string, options PauseUnPauseOptions) ([]*PauseUnpauseReport, error) ContainerPause(ctx context.Context, namesOrIds []string, options PauseUnPauseOptions) ([]*PauseUnpauseReport, error)
ContainerPort(ctx context.Context, nameOrId string, options ContainerPortOptions) ([]*ContainerPortReport, error) ContainerPort(ctx context.Context, nameOrID string, options ContainerPortOptions) ([]*ContainerPortReport, error)
ContainerPrune(ctx context.Context, options ContainerPruneOptions) (*ContainerPruneReport, error) ContainerPrune(ctx context.Context, options ContainerPruneOptions) (*ContainerPruneReport, error)
ContainerRestart(ctx context.Context, namesOrIds []string, options RestartOptions) ([]*RestartReport, error) ContainerRestart(ctx context.Context, namesOrIds []string, options RestartOptions) ([]*RestartReport, error)
ContainerRestore(ctx context.Context, namesOrIds []string, options RestoreOptions) ([]*RestoreReport, error) ContainerRestore(ctx context.Context, namesOrIds []string, options RestoreOptions) ([]*RestoreReport, error)
@ -41,14 +41,14 @@ type ContainerEngine interface {
ContainerStats(ctx context.Context, namesOrIds []string, options ContainerStatsOptions) error ContainerStats(ctx context.Context, namesOrIds []string, options ContainerStatsOptions) error
ContainerStop(ctx context.Context, namesOrIds []string, options StopOptions) ([]*StopReport, error) ContainerStop(ctx context.Context, namesOrIds []string, options StopOptions) ([]*StopReport, error)
ContainerTop(ctx context.Context, options TopOptions) (*StringSliceReport, error) ContainerTop(ctx context.Context, options TopOptions) (*StringSliceReport, error)
ContainerUnmount(ctx context.Context, nameOrIds []string, options ContainerUnmountOptions) ([]*ContainerUnmountReport, error) ContainerUnmount(ctx context.Context, nameOrIDs []string, options ContainerUnmountOptions) ([]*ContainerUnmountReport, error)
ContainerUnpause(ctx context.Context, namesOrIds []string, options PauseUnPauseOptions) ([]*PauseUnpauseReport, error) ContainerUnpause(ctx context.Context, namesOrIds []string, options PauseUnPauseOptions) ([]*PauseUnpauseReport, error)
ContainerWait(ctx context.Context, namesOrIds []string, options WaitOptions) ([]WaitReport, error) ContainerWait(ctx context.Context, namesOrIds []string, options WaitOptions) ([]WaitReport, error)
Events(ctx context.Context, opts EventsOptions) error Events(ctx context.Context, opts EventsOptions) error
GenerateSystemd(ctx context.Context, nameOrID string, opts GenerateSystemdOptions) (*GenerateSystemdReport, error) GenerateSystemd(ctx context.Context, nameOrID string, opts GenerateSystemdOptions) (*GenerateSystemdReport, error)
GenerateKube(ctx context.Context, nameOrID string, opts GenerateKubeOptions) (*GenerateKubeReport, error) GenerateKube(ctx context.Context, nameOrID string, opts GenerateKubeOptions) (*GenerateKubeReport, error)
SystemPrune(ctx context.Context, options SystemPruneOptions) (*SystemPruneReport, error) SystemPrune(ctx context.Context, options SystemPruneOptions) (*SystemPruneReport, error)
HealthCheckRun(ctx context.Context, nameOrId string, options HealthCheckOptions) (*define.HealthCheckResults, error) HealthCheckRun(ctx context.Context, nameOrID string, options HealthCheckOptions) (*define.HealthCheckResults, error)
Info(ctx context.Context) (*define.Info, error) Info(ctx context.Context) (*define.Info, error)
NetworkCreate(ctx context.Context, name string, options NetworkCreateOptions) (*NetworkCreateReport, error) NetworkCreate(ctx context.Context, name string, options NetworkCreateOptions) (*NetworkCreateReport, error)
NetworkInspect(ctx context.Context, namesOrIds []string, options NetworkInspectOptions) ([]NetworkInspectReport, error) NetworkInspect(ctx context.Context, namesOrIds []string, options NetworkInspectOptions) ([]NetworkInspectReport, error)
@ -56,7 +56,7 @@ type ContainerEngine interface {
NetworkRm(ctx context.Context, namesOrIds []string, options NetworkRmOptions) ([]*NetworkRmReport, error) NetworkRm(ctx context.Context, namesOrIds []string, options NetworkRmOptions) ([]*NetworkRmReport, error)
PlayKube(ctx context.Context, path string, opts PlayKubeOptions) (*PlayKubeReport, error) PlayKube(ctx context.Context, path string, opts PlayKubeOptions) (*PlayKubeReport, error)
PodCreate(ctx context.Context, opts PodCreateOptions) (*PodCreateReport, error) PodCreate(ctx context.Context, opts PodCreateOptions) (*PodCreateReport, error)
PodExists(ctx context.Context, nameOrId string) (*BoolReport, error) PodExists(ctx context.Context, nameOrID string) (*BoolReport, error)
PodInspect(ctx context.Context, options PodInspectOptions) (*PodInspectReport, error) PodInspect(ctx context.Context, options PodInspectOptions) (*PodInspectReport, error)
PodKill(ctx context.Context, namesOrIds []string, options PodKillOptions) ([]*PodKillReport, error) PodKill(ctx context.Context, namesOrIds []string, options PodKillOptions) ([]*PodKillReport, error)
PodPause(ctx context.Context, namesOrIds []string, options PodPauseOptions) ([]*PodPauseReport, error) PodPause(ctx context.Context, namesOrIds []string, options PodPauseOptions) ([]*PodPauseReport, error)
@ -75,7 +75,7 @@ type ContainerEngine interface {
Unshare(ctx context.Context, args []string) error Unshare(ctx context.Context, args []string) error
VarlinkService(ctx context.Context, opts ServiceOptions) error VarlinkService(ctx context.Context, opts ServiceOptions) error
Version(ctx context.Context) (*SystemVersionReport, error) Version(ctx context.Context) (*SystemVersionReport, error)
VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*IdOrNameResponse, error) VolumeCreate(ctx context.Context, opts VolumeCreateOptions) (*IDOrNameResponse, error)
VolumeInspect(ctx context.Context, namesOrIds []string, opts VolumeInspectOptions) ([]*VolumeInspectReport, error) VolumeInspect(ctx context.Context, namesOrIds []string, opts VolumeInspectOptions) ([]*VolumeInspectReport, error)
VolumeList(ctx context.Context, opts VolumeListOptions) ([]*VolumeListReport, error) VolumeList(ctx context.Context, opts VolumeListOptions) ([]*VolumeListReport, error)
VolumePrune(ctx context.Context, opts VolumePruneOptions) ([]*VolumePruneReport, error) VolumePrune(ctx context.Context, opts VolumePruneOptions) ([]*VolumePruneReport, error)

View File

@ -9,9 +9,9 @@ import (
type ImageEngine interface { type ImageEngine interface {
Build(ctx context.Context, containerFiles []string, opts BuildOptions) (*BuildReport, error) Build(ctx context.Context, containerFiles []string, opts BuildOptions) (*BuildReport, error)
Config(ctx context.Context) (*config.Config, error) Config(ctx context.Context) (*config.Config, error)
Diff(ctx context.Context, nameOrId string, options DiffOptions) (*DiffReport, error) Diff(ctx context.Context, nameOrID string, options DiffOptions) (*DiffReport, error)
Exists(ctx context.Context, nameOrId string) (*BoolReport, error) Exists(ctx context.Context, nameOrID string) (*BoolReport, error)
History(ctx context.Context, nameOrId string, opts ImageHistoryOptions) (*ImageHistoryReport, error) History(ctx context.Context, nameOrID string, opts ImageHistoryOptions) (*ImageHistoryReport, error)
Import(ctx context.Context, opts ImageImportOptions) (*ImageImportReport, error) Import(ctx context.Context, opts ImageImportOptions) (*ImageImportReport, error)
Inspect(ctx context.Context, namesOrIDs []string, opts InspectOptions) ([]*ImageInspectReport, error) Inspect(ctx context.Context, namesOrIDs []string, opts InspectOptions) ([]*ImageInspectReport, error)
List(ctx context.Context, opts ImageListOptions) ([]*ImageSummary, error) List(ctx context.Context, opts ImageListOptions) ([]*ImageSummary, error)
@ -20,14 +20,14 @@ type ImageEngine interface {
Pull(ctx context.Context, rawImage string, opts ImagePullOptions) (*ImagePullReport, error) Pull(ctx context.Context, rawImage string, opts ImagePullOptions) (*ImagePullReport, error)
Push(ctx context.Context, source string, destination string, opts ImagePushOptions) error Push(ctx context.Context, source string, destination string, opts ImagePushOptions) error
Remove(ctx context.Context, images []string, opts ImageRemoveOptions) (*ImageRemoveReport, []error) Remove(ctx context.Context, images []string, opts ImageRemoveOptions) (*ImageRemoveReport, []error)
Save(ctx context.Context, nameOrId string, tags []string, options ImageSaveOptions) error Save(ctx context.Context, nameOrID string, tags []string, options ImageSaveOptions) error
Search(ctx context.Context, term string, opts ImageSearchOptions) ([]ImageSearchReport, error) Search(ctx context.Context, term string, opts ImageSearchOptions) ([]ImageSearchReport, error)
SetTrust(ctx context.Context, args []string, options SetTrustOptions) error SetTrust(ctx context.Context, args []string, options SetTrustOptions) error
ShowTrust(ctx context.Context, args []string, options ShowTrustOptions) (*ShowTrustReport, error) ShowTrust(ctx context.Context, args []string, options ShowTrustOptions) (*ShowTrustReport, error)
Shutdown(ctx context.Context) Shutdown(ctx context.Context)
Tag(ctx context.Context, nameOrId string, tags []string, options ImageTagOptions) error Tag(ctx context.Context, nameOrID string, tags []string, options ImageTagOptions) error
Tree(ctx context.Context, nameOrId string, options ImageTreeOptions) (*ImageTreeReport, error) Tree(ctx context.Context, nameOrID string, options ImageTreeOptions) (*ImageTreeReport, error)
Untag(ctx context.Context, nameOrId string, tags []string, options ImageUntagOptions) error Untag(ctx context.Context, nameOrID string, tags []string, options ImageUntagOptions) error
ManifestCreate(ctx context.Context, names, images []string, opts ManifestCreateOptions) (string, error) ManifestCreate(ctx context.Context, names, images []string, opts ManifestCreateOptions) (string, error)
ManifestInspect(ctx context.Context, name string) ([]byte, error) ManifestInspect(ctx context.Context, name string) ([]byte, error)
ManifestAdd(ctx context.Context, opts ManifestAddOptions) (string, error) ManifestAdd(ctx context.Context, opts ManifestAddOptions) (string, error)

View File

@ -20,14 +20,14 @@ type Names interface {
Names() []string Names() []string
} }
// IdOrName interface allows filters to access ID() or Name() of object // IDOrName interface allows filters to access ID() or Name() of object
type IdOrNamed interface { type IDOrNamed interface {
Identifier Identifier
Named Named
} }
// IdOrName interface allows filters to access ID() or Names() of object // IDOrName interface allows filters to access ID() or Names() of object
type IdOrNames interface { type IDOrNames interface {
Identifier Identifier
Names Names
} }
@ -42,11 +42,11 @@ func CompileImageFilters(filters url.Values) ImageFilter {
for name, targets := range filters { for name, targets := range filters {
switch name { switch name {
case "id": case "id":
fns = append(fns, FilterIdFn(targets)) fns = append(fns, FilterIDFn(targets))
case "name": case "name":
fns = append(fns, FilterNamesFn(targets)) fns = append(fns, FilterNamesFn(targets))
case "idOrName": case "idOrName":
fns = append(fns, FilterIdOrNameFn(targets)) fns = append(fns, FilterIDOrNameFn(targets))
} }
} }
@ -66,11 +66,11 @@ func CompileContainerFilters(filters url.Values) ContainerFilter {
for name, targets := range filters { for name, targets := range filters {
switch name { switch name {
case "id": case "id":
fns = append(fns, FilterIdFn(targets)) fns = append(fns, FilterIDFn(targets))
case "name": case "name":
fns = append(fns, FilterNameFn(targets)) fns = append(fns, FilterNameFn(targets))
case "idOrName": case "idOrName":
fns = append(fns, FilterIdOrNameFn(targets)) fns = append(fns, FilterIDOrNameFn(targets))
} }
} }
@ -89,7 +89,7 @@ func CompileVolumeFilters(filters url.Values) VolumeFilter {
for name, targets := range filters { for name, targets := range filters {
if name == "id" { if name == "id" {
fns = append(fns, FilterIdFn(targets)) fns = append(fns, FilterIDFn(targets))
} }
} }
@ -103,7 +103,7 @@ func CompileVolumeFilters(filters url.Values) VolumeFilter {
} }
} }
func FilterIdFn(id []string) func(Identifier) bool { func FilterIDFn(id []string) func(Identifier) bool {
return func(obj Identifier) bool { return func(obj Identifier) bool {
for _, v := range id { for _, v := range id {
if strings.Contains(obj.Id(), v) { if strings.Contains(obj.Id(), v) {
@ -138,8 +138,8 @@ func FilterNamesFn(name []string) func(Names) bool {
} }
} }
func FilterIdOrNameFn(id []string) func(IdOrNamed) bool { func FilterIDOrNameFn(id []string) func(IDOrNamed) bool {
return func(obj IdOrNamed) bool { return func(obj IDOrNamed) bool {
for _, v := range id { for _, v := range id {
if strings.Contains(obj.Id(), v) || strings.Contains(obj.Name(), v) { if strings.Contains(obj.Id(), v) || strings.Contains(obj.Name(), v) {
return true return true

View File

@ -45,13 +45,13 @@ type Image struct {
HealthCheck *manifest.Schema2HealthConfig `json:",omitempty"` HealthCheck *manifest.Schema2HealthConfig `json:",omitempty"`
} }
func (i *Image) Id() string { func (i *Image) Id() string { //nolint
return i.ID return i.ID
} }
type ImageSummary struct { type ImageSummary struct {
ID string `json:"Id"` ID string `json:"Id"`
ParentId string `json:",omitempty"` ParentId string `json:",omitempty"` // nolint
RepoTags []string `json:",omitempty"` RepoTags []string `json:",omitempty"`
Created time.Time `json:",omitempty"` Created time.Time `json:",omitempty"`
Size int64 `json:",omitempty"` Size int64 `json:",omitempty"`
@ -70,7 +70,7 @@ type ImageSummary struct {
History []string `json:",omitempty"` History []string `json:",omitempty"`
} }
func (i *ImageSummary) Id() string { func (i *ImageSummary) Id() string { //nolint
return i.ID return i.ID
} }
@ -266,7 +266,7 @@ type ImageImportOptions struct {
} }
type ImageImportReport struct { type ImageImportReport struct {
Id string Id string //nolint
} }
type ImageSaveOptions struct { type ImageSaveOptions struct {

View File

@ -17,15 +17,15 @@ type PodKillOptions struct {
type PodKillReport struct { type PodKillReport struct {
Errs []error Errs []error
Id string Id string //nolint
} }
type ListPodsReport struct { type ListPodsReport struct {
Cgroup string Cgroup string
Containers []*ListPodContainer Containers []*ListPodContainer
Created time.Time Created time.Time
Id string Id string //nolint
InfraId string InfraId string //nolint
Name string Name string
Namespace string Namespace string
Status string Status string
@ -33,7 +33,7 @@ type ListPodsReport struct {
} }
type ListPodContainer struct { type ListPodContainer struct {
Id string Id string //nolint
Names string Names string
Status string Status string
} }
@ -45,7 +45,7 @@ type PodPauseOptions struct {
type PodPauseReport struct { type PodPauseReport struct {
Errs []error Errs []error
Id string Id string //nolint
} }
type PodunpauseOptions struct { type PodunpauseOptions struct {
@ -55,7 +55,7 @@ type PodunpauseOptions struct {
type PodUnpauseReport struct { type PodUnpauseReport struct {
Errs []error Errs []error
Id string Id string //nolint
} }
type PodStopOptions struct { type PodStopOptions struct {
@ -67,7 +67,7 @@ type PodStopOptions struct {
type PodStopReport struct { type PodStopReport struct {
Errs []error Errs []error
Id string Id string //nolint
} }
type PodRestartOptions struct { type PodRestartOptions struct {
@ -77,7 +77,7 @@ type PodRestartOptions struct {
type PodRestartReport struct { type PodRestartReport struct {
Errs []error Errs []error
Id string Id string //nolint
} }
type PodStartOptions struct { type PodStartOptions struct {
@ -87,7 +87,7 @@ type PodStartOptions struct {
type PodStartReport struct { type PodStartReport struct {
Errs []error Errs []error
Id string Id string //nolint
} }
type PodRmOptions struct { type PodRmOptions struct {
@ -99,7 +99,7 @@ type PodRmOptions struct {
type PodRmReport struct { type PodRmReport struct {
Err error Err error
Id string Id string //nolint
} }
type PodCreateOptions struct { type PodCreateOptions struct {
@ -115,7 +115,7 @@ type PodCreateOptions struct {
} }
type PodCreateReport struct { type PodCreateReport struct {
Id string Id string //nolint
} }
func (p PodCreateOptions) ToPodSpecGen(s *specgen.PodSpecGenerator) { func (p PodCreateOptions) ToPodSpecGen(s *specgen.PodSpecGenerator) {
@ -155,7 +155,7 @@ type PodPruneOptions struct {
type PodPruneReport struct { type PodPruneReport struct {
Err error Err error
Id string Id string //nolint
} }
type PodTopOptions struct { type PodTopOptions struct {

View File

@ -4,12 +4,12 @@ import (
"strings" "strings"
) )
type stringSet struct { type StringSet struct {
m map[string]struct{} m map[string]struct{}
} }
func NewStringSet(elem ...string) *stringSet { func NewStringSet(elem ...string) *StringSet {
s := &stringSet{} s := &StringSet{}
s.m = make(map[string]struct{}, len(elem)) s.m = make(map[string]struct{}, len(elem))
for _, e := range elem { for _, e := range elem {
s.Add(e) s.Add(e)
@ -17,20 +17,20 @@ func NewStringSet(elem ...string) *stringSet {
return s return s
} }
func (s *stringSet) Add(elem string) { func (s *StringSet) Add(elem string) {
s.m[elem] = struct{}{} s.m[elem] = struct{}{}
} }
func (s *stringSet) Remove(elem string) { func (s *StringSet) Remove(elem string) {
delete(s.m, elem) delete(s.m, elem)
} }
func (s *stringSet) Contains(elem string) bool { func (s *StringSet) Contains(elem string) bool {
_, ok := s.m[elem] _, ok := s.m[elem]
return ok return ok
} }
func (s *stringSet) Elements() []string { func (s *StringSet) Elements() []string {
keys := make([]string, len(s.m)) keys := make([]string, len(s.m))
i := 0 i := 0
for k := range s.m { for k := range s.m {
@ -40,6 +40,6 @@ func (s *stringSet) Elements() []string {
return keys return keys
} }
func (s *stringSet) String() string { func (s *StringSet) String() string {
return strings.Join(s.Elements(), ", ") return strings.Join(s.Elements(), ", ")
} }

View File

@ -11,7 +11,7 @@ import (
) )
type Container struct { type Container struct {
IdOrNamed IDOrNamed
} }
type Volume struct { type Volume struct {
@ -19,7 +19,7 @@ type Volume struct {
} }
type Report struct { type Report struct {
Id []string Id []string //nolint
Err map[string]error Err map[string]error
} }

View File

@ -16,9 +16,9 @@ type VolumeCreateOptions struct {
Options map[string]string `schema:"opts"` Options map[string]string `schema:"opts"`
} }
type IdOrNameResponse struct { type IDOrNameResponse struct {
// The Id or Name of an object // The Id or Name of an object
IdOrName string IDOrName string
} }
type VolumeConfigResponse struct { type VolumeConfigResponse struct {
@ -63,7 +63,7 @@ type VolumeRmOptions struct {
type VolumeRmReport struct { type VolumeRmReport struct {
Err error Err error
Id string Id string //nolint
} }
type VolumeInspectOptions struct { type VolumeInspectOptions struct {
@ -80,7 +80,7 @@ type VolumePruneOptions struct {
type VolumePruneReport struct { type VolumePruneReport struct {
Err error Err error
Id string Id string //nolint
} }
type VolumeListOptions struct { type VolumeListOptions struct {

View File

@ -75,8 +75,8 @@ func getContainersByContext(all, latest bool, names []string, runtime *libpod.Ru
} }
// TODO: Should return *entities.ContainerExistsReport, error // TODO: Should return *entities.ContainerExistsReport, error
func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrId string) (*entities.BoolReport, error) { func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrID string) (*entities.BoolReport, error) {
_, err := ic.Libpod.LookupContainer(nameOrId) _, err := ic.Libpod.LookupContainer(nameOrID)
if err != nil && errors.Cause(err) != define.ErrNoSuchCtr { if err != nil && errors.Cause(err) != define.ErrNoSuchCtr {
return nil, err return nil, err
} }
@ -384,11 +384,11 @@ func (ic *ContainerEngine) ContainerTop(ctx context.Context, options entities.To
return report, err return report, err
} }
func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrId string, options entities.CommitOptions) (*entities.CommitReport, error) { func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrID string, options entities.CommitOptions) (*entities.CommitReport, error) {
var ( var (
mimeType string mimeType string
) )
ctr, err := ic.Libpod.LookupContainer(nameOrId) ctr, err := ic.Libpod.LookupContainer(nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -429,8 +429,8 @@ func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrId string,
return &entities.CommitReport{Id: newImage.ID()}, nil return &entities.CommitReport{Id: newImage.ID()}, nil
} }
func (ic *ContainerEngine) ContainerExport(ctx context.Context, nameOrId string, options entities.ContainerExportOptions) error { func (ic *ContainerEngine) ContainerExport(ctx context.Context, nameOrID string, options entities.ContainerExportOptions) error {
ctr, err := ic.Libpod.LookupContainer(nameOrId) ctr, err := ic.Libpod.LookupContainer(nameOrID)
if err != nil { if err != nil {
return err return err
} }
@ -528,8 +528,8 @@ func (ic *ContainerEngine) ContainerCreate(ctx context.Context, s *specgen.SpecG
return &entities.ContainerCreateReport{Id: ctr.ID()}, nil return &entities.ContainerCreateReport{Id: ctr.ID()}, nil
} }
func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrId string, options entities.AttachOptions) error { func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string, options entities.AttachOptions) error {
ctrs, err := getContainersByContext(false, options.Latest, []string{nameOrId}, ic.Libpod) ctrs, err := getContainersByContext(false, options.Latest, []string{nameOrID}, ic.Libpod)
if err != nil { if err != nil {
return err return err
} }
@ -591,12 +591,12 @@ func checkExecPreserveFDs(options entities.ExecOptions) (int, error) {
return ec, nil return ec, nil
} }
func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrId string, options entities.ExecOptions, streams define.AttachStreams) (int, error) { func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrID string, options entities.ExecOptions, streams define.AttachStreams) (int, error) {
ec, err := checkExecPreserveFDs(options) ec, err := checkExecPreserveFDs(options)
if err != nil { if err != nil {
return ec, err return ec, err
} }
ctrs, err := getContainersByContext(false, options.Latest, []string{nameOrId}, ic.Libpod) ctrs, err := getContainersByContext(false, options.Latest, []string{nameOrID}, ic.Libpod)
if err != nil { if err != nil {
return ec, err return ec, err
} }
@ -608,12 +608,12 @@ func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrId string, o
return define.TranslateExecErrorToExitCode(ec, err), err return define.TranslateExecErrorToExitCode(ec, err), err
} }
func (ic *ContainerEngine) ContainerExecDetached(ctx context.Context, nameOrId string, options entities.ExecOptions) (string, error) { func (ic *ContainerEngine) ContainerExecDetached(ctx context.Context, nameOrID string, options entities.ExecOptions) (string, error) {
_, err := checkExecPreserveFDs(options) _, err := checkExecPreserveFDs(options)
if err != nil { if err != nil {
return "", err return "", err
} }
ctrs, err := getContainersByContext(false, options.Latest, []string{nameOrId}, ic.Libpod) ctrs, err := getContainersByContext(false, options.Latest, []string{nameOrID}, ic.Libpod)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -767,15 +767,15 @@ func (ic *ContainerEngine) ContainerList(ctx context.Context, options entities.C
} }
// ContainerDiff provides changes to given container // ContainerDiff provides changes to given container
func (ic *ContainerEngine) ContainerDiff(ctx context.Context, nameOrId string, opts entities.DiffOptions) (*entities.DiffReport, error) { func (ic *ContainerEngine) ContainerDiff(ctx context.Context, nameOrID string, opts entities.DiffOptions) (*entities.DiffReport, error) {
if opts.Latest { if opts.Latest {
ctnr, err := ic.Libpod.GetLatestContainer() ctnr, err := ic.Libpod.GetLatestContainer()
if err != nil { if err != nil {
return nil, errors.Wrap(err, "unable to get latest container") return nil, errors.Wrap(err, "unable to get latest container")
} }
nameOrId = ctnr.ID() nameOrID = ctnr.ID()
} }
changes, err := ic.Libpod.GetDiff("", nameOrId) changes, err := ic.Libpod.GetDiff("", nameOrID)
return &entities.DiffReport{Changes: changes}, err return &entities.DiffReport{Changes: changes}, err
} }
@ -977,7 +977,7 @@ func (ic *ContainerEngine) ContainerInit(ctx context.Context, namesOrIds []strin
return reports, nil return reports, nil
} }
func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIds []string, options entities.ContainerMountOptions) ([]*entities.ContainerMountReport, error) { func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIDs []string, options entities.ContainerMountOptions) ([]*entities.ContainerMountReport, error) {
if os.Geteuid() != 0 { if os.Geteuid() != 0 {
if driver := ic.Libpod.StorageConfig().GraphDriverName; driver != "vfs" { if driver := ic.Libpod.StorageConfig().GraphDriverName; driver != "vfs" {
// Do not allow to mount a graphdriver that is not vfs if we are creating the userns as part // Do not allow to mount a graphdriver that is not vfs if we are creating the userns as part
@ -994,7 +994,7 @@ func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIds []strin
} }
} }
var reports []*entities.ContainerMountReport var reports []*entities.ContainerMountReport
ctrs, err := getContainersByContext(options.All, options.Latest, nameOrIds, ic.Libpod) ctrs, err := getContainersByContext(options.All, options.Latest, nameOrIDs, ic.Libpod)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1029,9 +1029,9 @@ func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIds []strin
return reports, nil return reports, nil
} }
func (ic *ContainerEngine) ContainerUnmount(ctx context.Context, nameOrIds []string, options entities.ContainerUnmountOptions) ([]*entities.ContainerUnmountReport, error) { func (ic *ContainerEngine) ContainerUnmount(ctx context.Context, nameOrIDs []string, options entities.ContainerUnmountOptions) ([]*entities.ContainerUnmountReport, error) {
var reports []*entities.ContainerUnmountReport var reports []*entities.ContainerUnmountReport
ctrs, err := getContainersByContext(options.All, options.Latest, nameOrIds, ic.Libpod) ctrs, err := getContainersByContext(options.All, options.Latest, nameOrIDs, ic.Libpod)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1064,9 +1064,9 @@ func (ic *ContainerEngine) Config(_ context.Context) (*config.Config, error) {
return ic.Libpod.GetConfig() return ic.Libpod.GetConfig()
} }
func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrId string, options entities.ContainerPortOptions) ([]*entities.ContainerPortReport, error) { func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrID string, options entities.ContainerPortOptions) ([]*entities.ContainerPortReport, error) {
var reports []*entities.ContainerPortReport var reports []*entities.ContainerPortReport
ctrs, err := getContainersByContext(options.All, options.Latest, []string{nameOrId}, ic.Libpod) ctrs, err := getContainersByContext(options.All, options.Latest, []string{nameOrID}, ic.Libpod)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -7,8 +7,8 @@ import (
"github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/domain/entities"
) )
func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrId string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) { func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrID string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) {
status, err := ic.Libpod.HealthCheck(nameOrId) status, err := ic.Libpod.HealthCheck(nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -38,8 +38,8 @@ import (
// SignatureStoreDir defines default directory to store signatures // SignatureStoreDir defines default directory to store signatures
const SignatureStoreDir = "/var/lib/containers/sigstore" const SignatureStoreDir = "/var/lib/containers/sigstore"
func (ir *ImageEngine) Exists(_ context.Context, nameOrId string) (*entities.BoolReport, error) { func (ir *ImageEngine) Exists(_ context.Context, nameOrID string) (*entities.BoolReport, error) {
_, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrId) _, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrID)
if err != nil && errors.Cause(err) != define.ErrNoSuchImage { if err != nil && errors.Cause(err) != define.ErrNoSuchImage {
return nil, err return nil, err
} }
@ -65,8 +65,8 @@ func (ir *ImageEngine) pruneImagesHelper(ctx context.Context, all bool, filters
return &report, nil return &report, nil
} }
func (ir *ImageEngine) History(ctx context.Context, nameOrId string, opts entities.ImageHistoryOptions) (*entities.ImageHistoryReport, error) { func (ir *ImageEngine) History(ctx context.Context, nameOrID string, opts entities.ImageHistoryOptions) (*entities.ImageHistoryReport, error) {
image, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrId) image, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -261,8 +261,8 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
nil) nil)
} }
// func (r *imageRuntime) Delete(ctx context.Context, nameOrId string, opts entities.ImageDeleteOptions) (*entities.ImageDeleteReport, error) { // func (r *imageRuntime) Delete(ctx context.Context, nameOrID string, opts entities.ImageDeleteOptions) (*entities.ImageDeleteReport, error) {
// image, err := r.libpod.ImageEngine().NewFromLocal(nameOrId) // image, err := r.libpod.ImageEngine().NewFromLocal(nameOrID)
// if err != nil { // if err != nil {
// return nil, err // return nil, err
// } // }
@ -292,8 +292,8 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
// return &report, nil // return &report, nil
// } // }
func (ir *ImageEngine) Tag(ctx context.Context, nameOrId string, tags []string, options entities.ImageTagOptions) error { func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, options entities.ImageTagOptions) error {
newImage, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrId) newImage, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrID)
if err != nil { if err != nil {
return err return err
} }
@ -305,8 +305,8 @@ func (ir *ImageEngine) Tag(ctx context.Context, nameOrId string, tags []string,
return nil return nil
} }
func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string, options entities.ImageUntagOptions) error { func (ir *ImageEngine) Untag(ctx context.Context, nameOrID string, tags []string, options entities.ImageUntagOptions) error {
newImage, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrId) newImage, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrID)
if err != nil { if err != nil {
return err return err
} }
@ -356,16 +356,16 @@ func (ir *ImageEngine) Import(ctx context.Context, opts entities.ImageImportOpti
return &entities.ImageImportReport{Id: id}, nil return &entities.ImageImportReport{Id: id}, nil
} }
func (ir *ImageEngine) Save(ctx context.Context, nameOrId string, tags []string, options entities.ImageSaveOptions) error { func (ir *ImageEngine) Save(ctx context.Context, nameOrID string, tags []string, options entities.ImageSaveOptions) error {
newImage, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrId) newImage, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrID)
if err != nil { if err != nil {
return err return err
} }
return newImage.Save(ctx, nameOrId, options.Format, options.Output, tags, options.Quiet, options.Compress) return newImage.Save(ctx, nameOrID, options.Format, options.Output, tags, options.Quiet, options.Compress)
} }
func (ir *ImageEngine) Diff(_ context.Context, nameOrId string, _ entities.DiffOptions) (*entities.DiffReport, error) { func (ir *ImageEngine) Diff(_ context.Context, nameOrID string, _ entities.DiffOptions) (*entities.DiffReport, error) {
changes, err := ir.Libpod.GetDiff("", nameOrId) changes, err := ir.Libpod.GetDiff("", nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -420,8 +420,8 @@ func (ir *ImageEngine) Build(ctx context.Context, containerFiles []string, opts
return &entities.BuildReport{ID: id}, nil return &entities.BuildReport{ID: id}, nil
} }
func (ir *ImageEngine) Tree(ctx context.Context, nameOrId string, opts entities.ImageTreeOptions) (*entities.ImageTreeReport, error) { func (ir *ImageEngine) Tree(ctx context.Context, nameOrID string, opts entities.ImageTreeOptions) (*entities.ImageTreeReport, error) {
img, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrId) img, err := ir.Libpod.ImageRuntime().NewFromLocal(nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -45,8 +45,8 @@ func getPodsByContext(all, latest bool, pods []string, runtime *libpod.Runtime)
return outpods, err return outpods, err
} }
func (ic *ContainerEngine) PodExists(ctx context.Context, nameOrId string) (*entities.BoolReport, error) { func (ic *ContainerEngine) PodExists(ctx context.Context, nameOrID string) (*entities.BoolReport, error) {
_, err := ic.Libpod.LookupPod(nameOrId) _, err := ic.Libpod.LookupPod(nameOrID)
if err != nil && errors.Cause(err) != define.ErrNoSuchPod { if err != nil && errors.Cause(err) != define.ErrNoSuchPod {
return nil, err return nil, err
} }
@ -347,7 +347,7 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti
Status: state.String(), Status: state.String(),
}) })
} }
infraId, err := p.InfraContainerID() infraID, err := p.InfraContainerID()
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -356,7 +356,7 @@ func (ic *ContainerEngine) PodPs(ctx context.Context, options entities.PodPSOpti
Containers: lpcs, Containers: lpcs,
Created: p.CreatedTime(), Created: p.CreatedTime(),
Id: p.ID(), Id: p.ID(),
InfraId: infraId, InfraId: infraID,
Name: p.Name(), Name: p.Name(),
Namespace: p.Namespace(), Namespace: p.Namespace(),
Status: status, Status: status,

View File

@ -10,7 +10,7 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.VolumeCreateOptions) (*entities.IdOrNameResponse, error) { func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.VolumeCreateOptions) (*entities.IDOrNameResponse, error) {
var ( var (
volumeOptions []libpod.VolumeCreateOption volumeOptions []libpod.VolumeCreateOption
) )
@ -34,7 +34,7 @@ func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.Volum
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &entities.IdOrNameResponse{IdOrName: vol.Name()}, nil return &entities.IDOrNameResponse{IDOrName: vol.Name()}, nil
} }
func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, opts entities.VolumeRmOptions) ([]*entities.VolumeRmReport, error) { func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, opts entities.VolumeRmOptions) ([]*entities.VolumeRmReport, error) {

View File

@ -26,8 +26,8 @@ func (ic *ContainerEngine) ContainerRunlabel(ctx context.Context, label string,
return errors.New("not implemented") return errors.New("not implemented")
} }
func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrId string) (*entities.BoolReport, error) { func (ic *ContainerEngine) ContainerExists(ctx context.Context, nameOrID string) (*entities.BoolReport, error) {
exists, err := containers.Exists(ic.ClientCxt, nameOrId) exists, err := containers.Exists(ic.ClientCxt, nameOrID)
return &entities.BoolReport{Value: exists}, err return &entities.BoolReport{Value: exists}, err
} }
@ -230,7 +230,7 @@ func (ic *ContainerEngine) ContainerTop(ctx context.Context, options entities.To
return &entities.StringSliceReport{Value: topOutput}, nil return &entities.StringSliceReport{Value: topOutput}, nil
} }
func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrId string, options entities.CommitOptions) (*entities.CommitReport, error) { func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrID string, options entities.CommitOptions) (*entities.CommitReport, error) {
var ( var (
repo string repo string
tag = "latest" tag = "latest"
@ -259,14 +259,14 @@ func (ic *ContainerEngine) ContainerCommit(ctx context.Context, nameOrId string,
Repo: &repo, Repo: &repo,
Tag: &tag, Tag: &tag,
} }
response, err := containers.Commit(ic.ClientCxt, nameOrId, commitOpts) response, err := containers.Commit(ic.ClientCxt, nameOrID, commitOpts)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &entities.CommitReport{Id: response.ID}, nil return &entities.CommitReport{Id: response.ID}, nil
} }
func (ic *ContainerEngine) ContainerExport(ctx context.Context, nameOrId string, options entities.ContainerExportOptions) error { func (ic *ContainerEngine) ContainerExport(ctx context.Context, nameOrID string, options entities.ContainerExportOptions) error {
var ( var (
err error err error
w io.Writer w io.Writer
@ -277,7 +277,7 @@ func (ic *ContainerEngine) ContainerExport(ctx context.Context, nameOrId string,
return err return err
} }
} }
return containers.Export(ic.ClientCxt, nameOrId, w) return containers.Export(ic.ClientCxt, nameOrID, w)
} }
func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds []string, options entities.CheckpointOptions) ([]*entities.CheckpointReport, error) { func (ic *ContainerEngine) ContainerCheckpoint(ctx context.Context, namesOrIds []string, options entities.CheckpointOptions) ([]*entities.CheckpointReport, error) {
@ -357,7 +357,7 @@ func (ic *ContainerEngine) ContainerCreate(ctx context.Context, s *specgen.SpecG
return &entities.ContainerCreateReport{Id: response.ID}, nil return &entities.ContainerCreateReport{Id: response.ID}, nil
} }
func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIds []string, options entities.ContainerLogsOptions) error { func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string, options entities.ContainerLogsOptions) error {
since := options.Since.Format(time.RFC3339) since := options.Since.Format(time.RFC3339)
tail := strconv.FormatInt(options.Tail, 10) tail := strconv.FormatInt(options.Tail, 10)
stdout := options.Writer != nil stdout := options.Writer != nil
@ -375,7 +375,7 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIds []string,
outCh := make(chan string) outCh := make(chan string)
ctx, cancel := context.WithCancel(context.Background()) ctx, cancel := context.WithCancel(context.Background())
go func() { go func() {
err = containers.Logs(ic.ClientCxt, nameOrIds[0], opts, outCh, outCh) err = containers.Logs(ic.ClientCxt, nameOrIDs[0], opts, outCh, outCh)
cancel() cancel()
}() }()
@ -389,8 +389,8 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIds []string,
} }
} }
func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrId string, options entities.AttachOptions) error { func (ic *ContainerEngine) ContainerAttach(ctx context.Context, nameOrID string, options entities.AttachOptions) error {
return containers.Attach(ic.ClientCxt, nameOrId, &options.DetachKeys, nil, bindings.PTrue, options.Stdin, options.Stdout, options.Stderr, nil) return containers.Attach(ic.ClientCxt, nameOrID, &options.DetachKeys, nil, bindings.PTrue, options.Stdin, options.Stdout, options.Stderr, nil)
} }
func makeExecConfig(options entities.ExecOptions) *handlers.ExecCreateConfig { func makeExecConfig(options entities.ExecOptions) *handlers.ExecCreateConfig {
@ -415,10 +415,10 @@ func makeExecConfig(options entities.ExecOptions) *handlers.ExecCreateConfig {
return createConfig return createConfig
} }
func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrId string, options entities.ExecOptions, streams define.AttachStreams) (int, error) { func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrID string, options entities.ExecOptions, streams define.AttachStreams) (int, error) {
createConfig := makeExecConfig(options) createConfig := makeExecConfig(options)
sessionID, err := containers.ExecCreate(ic.ClientCxt, nameOrId, createConfig) sessionID, err := containers.ExecCreate(ic.ClientCxt, nameOrID, createConfig)
if err != nil { if err != nil {
return 125, err return 125, err
} }
@ -435,10 +435,10 @@ func (ic *ContainerEngine) ContainerExec(ctx context.Context, nameOrId string, o
return inspectOut.ExitCode, nil return inspectOut.ExitCode, nil
} }
func (ic *ContainerEngine) ContainerExecDetached(ctx context.Context, nameOrId string, options entities.ExecOptions) (string, error) { func (ic *ContainerEngine) ContainerExecDetached(ctx context.Context, nameOrID string, options entities.ExecOptions) (string, error) {
createConfig := makeExecConfig(options) createConfig := makeExecConfig(options)
sessionID, err := containers.ExecCreate(ic.ClientCxt, nameOrId, createConfig) sessionID, err := containers.ExecCreate(ic.ClientCxt, nameOrID, createConfig)
if err != nil { if err != nil {
return "", err return "", err
} }
@ -525,8 +525,8 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta
return &report, err return &report, err
} }
func (ic *ContainerEngine) ContainerDiff(ctx context.Context, nameOrId string, _ entities.DiffOptions) (*entities.DiffReport, error) { func (ic *ContainerEngine) ContainerDiff(ctx context.Context, nameOrID string, _ entities.DiffOptions) (*entities.DiffReport, error) {
changes, err := containers.Diff(ic.ClientCxt, nameOrId) changes, err := containers.Diff(ic.ClientCxt, nameOrID)
return &entities.DiffReport{Changes: changes}, err return &entities.DiffReport{Changes: changes}, err
} }
@ -555,11 +555,11 @@ func (ic *ContainerEngine) ContainerInit(ctx context.Context, namesOrIds []strin
return reports, nil return reports, nil
} }
func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIds []string, options entities.ContainerMountOptions) ([]*entities.ContainerMountReport, error) { func (ic *ContainerEngine) ContainerMount(ctx context.Context, nameOrIDs []string, options entities.ContainerMountOptions) ([]*entities.ContainerMountReport, error) {
return nil, errors.New("mounting containers is not supported for remote clients") return nil, errors.New("mounting containers is not supported for remote clients")
} }
func (ic *ContainerEngine) ContainerUnmount(ctx context.Context, nameOrIds []string, options entities.ContainerUnmountOptions) ([]*entities.ContainerUnmountReport, error) { func (ic *ContainerEngine) ContainerUnmount(ctx context.Context, nameOrIDs []string, options entities.ContainerUnmountOptions) ([]*entities.ContainerUnmountReport, error) {
return nil, errors.New("unmounting containers is not supported for remote clients") return nil, errors.New("unmounting containers is not supported for remote clients")
} }
@ -567,13 +567,13 @@ func (ic *ContainerEngine) Config(_ context.Context) (*config.Config, error) {
return config.Default() return config.Default()
} }
func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrId string, options entities.ContainerPortOptions) ([]*entities.ContainerPortReport, error) { func (ic *ContainerEngine) ContainerPort(ctx context.Context, nameOrID string, options entities.ContainerPortOptions) ([]*entities.ContainerPortReport, error) {
var ( var (
reports []*entities.ContainerPortReport reports []*entities.ContainerPortReport
namesOrIds []string namesOrIds []string
) )
if len(nameOrId) > 0 { if len(nameOrID) > 0 {
namesOrIds = append(namesOrIds, nameOrId) namesOrIds = append(namesOrIds, nameOrID)
} }
ctrs, err := getContainersByContext(ic.ClientCxt, options.All, namesOrIds) ctrs, err := getContainersByContext(ic.ClientCxt, options.All, namesOrIds)
if err != nil { if err != nil {

View File

@ -8,6 +8,6 @@ import (
"github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/domain/entities"
) )
func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrId string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) { func (ic *ContainerEngine) HealthCheckRun(ctx context.Context, nameOrID string, options entities.HealthCheckOptions) (*define.HealthCheckResults, error) {
return containers.RunHealthCheck(ic.ClientCxt, nameOrId) return containers.RunHealthCheck(ic.ClientCxt, nameOrID)
} }

View File

@ -13,11 +13,11 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func getContainersByContext(contextWithConnection context.Context, all bool, namesOrIds []string) ([]entities.ListContainer, error) { func getContainersByContext(contextWithConnection context.Context, all bool, namesOrIDs []string) ([]entities.ListContainer, error) {
var ( var (
cons []entities.ListContainer cons []entities.ListContainer
) )
if all && len(namesOrIds) > 0 { if all && len(namesOrIDs) > 0 {
return nil, errors.New("cannot lookup containers and all") return nil, errors.New("cannot lookup containers and all")
} }
c, err := containers.List(contextWithConnection, nil, bindings.PTrue, nil, nil, nil, bindings.PTrue) c, err := containers.List(contextWithConnection, nil, bindings.PTrue, nil, nil, nil, bindings.PTrue)
@ -27,7 +27,7 @@ func getContainersByContext(contextWithConnection context.Context, all bool, nam
if all { if all {
return c, err return c, err
} }
for _, id := range namesOrIds { for _, id := range namesOrIDs {
var found bool var found bool
for _, con := range c { for _, con := range c {
if id == con.ID || strings.HasPrefix(con.ID, id) || util.StringInSlice(id, con.Names) { if id == con.ID || strings.HasPrefix(con.ID, id) || util.StringInSlice(id, con.Names) {
@ -43,11 +43,11 @@ func getContainersByContext(contextWithConnection context.Context, all bool, nam
return cons, nil return cons, nil
} }
func getPodsByContext(contextWithConnection context.Context, all bool, namesOrIds []string) ([]*entities.ListPodsReport, error) { func getPodsByContext(contextWithConnection context.Context, all bool, namesOrIDs []string) ([]*entities.ListPodsReport, error) {
var ( var (
sPods []*entities.ListPodsReport sPods []*entities.ListPodsReport
) )
if all && len(namesOrIds) > 0 { if all && len(namesOrIDs) > 0 {
return nil, errors.New("cannot lookup specific pods and all") return nil, errors.New("cannot lookup specific pods and all")
} }
@ -58,17 +58,17 @@ func getPodsByContext(contextWithConnection context.Context, all bool, namesOrId
if all { if all {
return fPods, nil return fPods, nil
} }
for _, nameOrId := range namesOrIds { for _, nameOrID := range namesOrIDs {
var found bool var found bool
for _, f := range fPods { for _, f := range fPods {
if f.Name == nameOrId || strings.HasPrefix(f.Id, nameOrId) { if f.Name == nameOrID || strings.HasPrefix(f.Id, nameOrID) {
sPods = append(sPods, f) sPods = append(sPods, f)
found = true found = true
break break
} }
} }
if !found { if !found {
return nil, errors.Wrapf(define.ErrNoSuchPod, "unable to find pod %q", nameOrId) return nil, errors.Wrapf(define.ErrNoSuchPod, "unable to find pod %q", nameOrID)
} }
} }
return sPods, nil return sPods, nil

View File

@ -18,8 +18,8 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (ir *ImageEngine) Exists(_ context.Context, nameOrId string) (*entities.BoolReport, error) { func (ir *ImageEngine) Exists(_ context.Context, nameOrID string) (*entities.BoolReport, error) {
found, err := images.Exists(ir.ClientCxt, nameOrId) found, err := images.Exists(ir.ClientCxt, nameOrID)
return &entities.BoolReport{Value: found}, err return &entities.BoolReport{Value: found}, err
} }
@ -50,8 +50,8 @@ func (ir *ImageEngine) List(ctx context.Context, opts entities.ImageListOptions)
return is, nil return is, nil
} }
func (ir *ImageEngine) History(ctx context.Context, nameOrId string, opts entities.ImageHistoryOptions) (*entities.ImageHistoryReport, error) { func (ir *ImageEngine) History(ctx context.Context, nameOrID string, opts entities.ImageHistoryOptions) (*entities.ImageHistoryReport, error) {
results, err := images.History(ir.ClientCxt, nameOrId) results, err := images.History(ir.ClientCxt, nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -98,7 +98,7 @@ func (ir *ImageEngine) Pull(ctx context.Context, rawImage string, options entiti
return &entities.ImagePullReport{Images: pulledImages}, nil return &entities.ImagePullReport{Images: pulledImages}, nil
} }
func (ir *ImageEngine) Tag(ctx context.Context, nameOrId string, tags []string, options entities.ImageTagOptions) error { func (ir *ImageEngine) Tag(ctx context.Context, nameOrID string, tags []string, options entities.ImageTagOptions) error {
for _, newTag := range tags { for _, newTag := range tags {
var ( var (
tag, repo string tag, repo string
@ -114,19 +114,19 @@ func (ir *ImageEngine) Tag(ctx context.Context, nameOrId string, tags []string,
repo = r.Name() repo = r.Name()
} }
if len(repo) < 1 { if len(repo) < 1 {
return errors.Errorf("invalid image name %q", nameOrId) return errors.Errorf("invalid image name %q", nameOrID)
} }
if err := images.Tag(ir.ClientCxt, nameOrId, tag, repo); err != nil { if err := images.Tag(ir.ClientCxt, nameOrID, tag, repo); err != nil {
return err return err
} }
} }
return nil return nil
} }
func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string, options entities.ImageUntagOptions) error { func (ir *ImageEngine) Untag(ctx context.Context, nameOrID string, tags []string, options entities.ImageUntagOptions) error {
// Remove all tags if none are provided // Remove all tags if none are provided
if len(tags) == 0 { if len(tags) == 0 {
newImage, err := images.GetImage(ir.ClientCxt, nameOrId, bindings.PFalse) newImage, err := images.GetImage(ir.ClientCxt, nameOrID, bindings.PFalse)
if err != nil { if err != nil {
return err return err
} }
@ -148,9 +148,9 @@ func (ir *ImageEngine) Untag(ctx context.Context, nameOrId string, tags []string
repo = r.Name() repo = r.Name()
} }
if len(repo) < 1 { if len(repo) < 1 {
return errors.Errorf("invalid image name %q", nameOrId) return errors.Errorf("invalid image name %q", nameOrID)
} }
if err := images.Untag(ir.ClientCxt, nameOrId, tag, repo); err != nil { if err := images.Untag(ir.ClientCxt, nameOrID, tag, repo); err != nil {
return err return err
} }
} }
@ -199,7 +199,7 @@ func (ir *ImageEngine) Push(ctx context.Context, source string, destination stri
return images.Push(ir.ClientCxt, source, destination, options) return images.Push(ir.ClientCxt, source, destination, options)
} }
func (ir *ImageEngine) Save(ctx context.Context, nameOrId string, tags []string, options entities.ImageSaveOptions) error { func (ir *ImageEngine) Save(ctx context.Context, nameOrID string, tags []string, options entities.ImageSaveOptions) error {
var ( var (
f *os.File f *os.File
err error err error
@ -217,7 +217,7 @@ func (ir *ImageEngine) Save(ctx context.Context, nameOrId string, tags []string,
return err return err
} }
exErr := images.Export(ir.ClientCxt, nameOrId, f, &options.Format, &options.Compress) exErr := images.Export(ir.ClientCxt, nameOrID, f, &options.Format, &options.Compress)
if err := f.Close(); err != nil { if err := f.Close(); err != nil {
return err return err
} }
@ -250,8 +250,8 @@ func (ir *ImageEngine) Save(ctx context.Context, nameOrId string, tags []string,
} }
// Diff reports the changes to the given image // Diff reports the changes to the given image
func (ir *ImageEngine) Diff(ctx context.Context, nameOrId string, _ entities.DiffOptions) (*entities.DiffReport, error) { func (ir *ImageEngine) Diff(ctx context.Context, nameOrID string, _ entities.DiffOptions) (*entities.DiffReport, error) {
changes, err := images.Diff(ir.ClientCxt, nameOrId) changes, err := images.Diff(ir.ClientCxt, nameOrID)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -277,8 +277,8 @@ func (ir *ImageEngine) Build(ctx context.Context, containerFiles []string, opts
return images.Build(ir.ClientCxt, containerFiles, opts, tarfile) return images.Build(ir.ClientCxt, containerFiles, opts, tarfile)
} }
func (ir *ImageEngine) Tree(ctx context.Context, nameOrId string, opts entities.ImageTreeOptions) (*entities.ImageTreeReport, error) { func (ir *ImageEngine) Tree(ctx context.Context, nameOrID string, opts entities.ImageTreeOptions) (*entities.ImageTreeReport, error) {
return images.Tree(ir.ClientCxt, nameOrId, &opts.WhatRequires) return images.Tree(ir.ClientCxt, nameOrID, &opts.WhatRequires)
} }
// Shutdown Libpod engine // Shutdown Libpod engine

View File

@ -10,8 +10,8 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
func (ic *ContainerEngine) PodExists(ctx context.Context, nameOrId string) (*entities.BoolReport, error) { func (ic *ContainerEngine) PodExists(ctx context.Context, nameOrID string) (*entities.BoolReport, error) {
exists, err := pods.Exists(ic.ClientCxt, nameOrId) exists, err := pods.Exists(ic.ClientCxt, nameOrID)
return &entities.BoolReport{Value: exists}, err return &entities.BoolReport{Value: exists}, err
} }

View File

@ -7,12 +7,12 @@ import (
"github.com/containers/libpod/pkg/domain/entities" "github.com/containers/libpod/pkg/domain/entities"
) )
func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.VolumeCreateOptions) (*entities.IdOrNameResponse, error) { func (ic *ContainerEngine) VolumeCreate(ctx context.Context, opts entities.VolumeCreateOptions) (*entities.IDOrNameResponse, error) {
response, err := volumes.Create(ic.ClientCxt, opts) response, err := volumes.Create(ic.ClientCxt, opts)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &entities.IdOrNameResponse{IdOrName: response.Name}, nil return &entities.IDOrNameResponse{IDOrName: response.Name}, nil
} }
func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, opts entities.VolumeRmOptions) ([]*entities.VolumeRmReport, error) { func (ic *ContainerEngine) VolumeRm(ctx context.Context, namesOrIds []string, opts entities.VolumeRmOptions) ([]*entities.VolumeRmReport, error) {