diff options
Diffstat (limited to 'cmd/podman/shared')
-rw-r--r-- | cmd/podman/shared/container.go | 4 | ||||
-rw-r--r-- | cmd/podman/shared/create.go | 4 | ||||
-rw-r--r-- | cmd/podman/shared/funcs.go | 21 | ||||
-rw-r--r-- | cmd/podman/shared/parallel.go | 2 | ||||
-rw-r--r-- | cmd/podman/shared/parse/parse_test.go | 4 | ||||
-rw-r--r-- | cmd/podman/shared/workers.go | 2 |
6 files changed, 16 insertions, 21 deletions
diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go index bc64d63a9..f49943477 100644 --- a/cmd/podman/shared/container.go +++ b/cmd/podman/shared/container.go @@ -453,7 +453,7 @@ func PBatch(containers []*libpod.Container, workers int, opts PsOptions) []PsCon psResults := []PsContainerOutput{} // If the number of containers in question is less than the number of - // proposed parallel operations, we shouldnt spawn so many workers. + // proposed parallel operations, we shouldn't spawn so many workers. if workers > len(containers) { workers = len(containers) } @@ -694,7 +694,7 @@ func portsToString(ports []ocicni.PortMapping) string { portgroup, ok := portGroupMap[portMapKey] if !ok { portGroupMap[portMapKey] = &portGroup{first: v.ContainerPort, last: v.ContainerPort} - // This list is required to travese portGroupMap. + // This list is required to traverse portGroupMap. groupKeyList = append(groupKeyList, portMapKey) continue } diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go index 14db999ae..f74c1c62d 100644 --- a/cmd/podman/shared/create.go +++ b/cmd/podman/shared/create.go @@ -93,7 +93,7 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod. ArchitectureChoice: c.String("override-arch"), } - newImage, err := runtime.ImageRuntime().New(ctx, name, rtc.SignaturePolicyPath, GetAuthFile(c.String("authfile")), writer, &dockerRegistryOptions, image.SigningOptions{}, nil, pullType) + newImage, err := runtime.ImageRuntime().New(ctx, name, rtc.SignaturePolicyPath, c.String("authfile"), writer, &dockerRegistryOptions, image.SigningOptions{}, nil, pullType) if err != nil { return nil, nil, err } @@ -111,7 +111,7 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod. // if the user disabled the healthcheck with "none", we skip adding it healthCheckCommandInput := c.String("healthcheck-command") - // the user didnt disable the healthcheck but did pass in a healthcheck command + // the user didn't disable the healthcheck but did pass in a healthcheck command // now we need to make a healthcheck from the commandline input if healthCheckCommandInput != "none" { if len(healthCheckCommandInput) > 0 { diff --git a/cmd/podman/shared/funcs.go b/cmd/podman/shared/funcs.go index 9362e8e9b..404d0f288 100644 --- a/cmd/podman/shared/funcs.go +++ b/cmd/podman/shared/funcs.go @@ -6,24 +6,19 @@ import ( "path/filepath" "strings" - "github.com/containers/libpod/pkg/util" + "github.com/containers/image/v5/types" + "github.com/containers/libpod/libpod/image" "github.com/google/shlex" + "github.com/pkg/errors" ) -func GetAuthFile(authfile string) string { +func GetSystemContext(authfile string) (*types.SystemContext, error) { if authfile != "" { - return authfile - } - - authfile = os.Getenv("REGISTRY_AUTH_FILE") - if authfile != "" { - return authfile - } - - if runtimeDir, err := util.GetRuntimeDir(); err == nil { - return filepath.Join(runtimeDir, "containers/auth.json") + if _, err := os.Stat(authfile); err != nil { + return nil, errors.Wrapf(err, "error checking authfile path %s", authfile) + } } - return "" + return image.GetSystemContext("", authfile, false), nil } func substituteCommand(cmd string) (string, error) { diff --git a/cmd/podman/shared/parallel.go b/cmd/podman/shared/parallel.go index e6ce50f95..eb1d40073 100644 --- a/cmd/podman/shared/parallel.go +++ b/cmd/podman/shared/parallel.go @@ -72,7 +72,7 @@ func ParallelExecuteWorkerPool(workers int, functions []ParallelWorkerInput) (ma } // Parallelize provides the maximum number of parallel workers (int) as calculated by a basic -// heuristic. This can be overriden by the --max-workers primary switch to podman. +// heuristic. This can be overridden by the --max-workers primary switch to podman. func Parallelize(job string) int { numCpus := runtime.NumCPU() switch job { diff --git a/cmd/podman/shared/parse/parse_test.go b/cmd/podman/shared/parse/parse_test.go index 0a221c244..1359076a0 100644 --- a/cmd/podman/shared/parse/parse_test.go +++ b/cmd/podman/shared/parse/parse_test.go @@ -82,8 +82,8 @@ func TestValidateFileName(t *testing.T) { args args wantErr bool }{ - {name: "good", args: args{filename: "/som/rand/path"}, wantErr: false}, - {name: "good", args: args{filename: "som/rand/path"}, wantErr: false}, + {name: "good", args: args{filename: "/some/rand/path"}, wantErr: false}, + {name: "good", args: args{filename: "some/rand/path"}, wantErr: false}, {name: "good", args: args{filename: "/"}, wantErr: false}, {name: "bad", args: args{filename: "/:"}, wantErr: true}, {name: "bad", args: args{filename: ":/"}, wantErr: true}, diff --git a/cmd/podman/shared/workers.go b/cmd/podman/shared/workers.go index b6e3f10e7..a9d6bb77e 100644 --- a/cmd/podman/shared/workers.go +++ b/cmd/podman/shared/workers.go @@ -106,7 +106,7 @@ func (p *Pool) newWorker(slot int) { } // DefaultPoolSize provides the maximum number of parallel workers (int) as calculated by a basic -// heuristic. This can be overriden by the --max-workers primary switch to podman. +// heuristic. This can be overridden by the --max-workers primary switch to podman. func DefaultPoolSize(name string) int { numCpus := runtime.NumCPU() switch name { |