diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/api/handlers/compat/events.go | 2 | ||||
-rw-r--r-- | pkg/api/server/register_play.go | 2 | ||||
-rw-r--r-- | pkg/auth/auth.go | 2 | ||||
-rw-r--r-- | pkg/bindings/test/system_test.go | 2 | ||||
-rw-r--r-- | pkg/domain/entities/engine.go | 1 | ||||
-rw-r--r-- | pkg/domain/entities/play.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/abi/manifest.go | 2 | ||||
-rw-r--r-- | pkg/domain/infra/runtime_libpod.go | 8 | ||||
-rw-r--r-- | pkg/domain/infra/tunnel/containers.go | 7 | ||||
-rw-r--r-- | pkg/errorhandling/errorhandling.go | 8 | ||||
-rw-r--r-- | pkg/network/netconflist_test.go | 2 | ||||
-rw-r--r-- | pkg/network/network.go | 2 | ||||
-rw-r--r-- | pkg/spec/spec.go | 2 | ||||
-rw-r--r-- | pkg/specgen/generate/storage.go | 2 | ||||
-rw-r--r-- | pkg/util/utils_linux_test.go | 2 | ||||
-rw-r--r-- | pkg/varlink/io.podman.varlink | 2 | ||||
-rw-r--r-- | pkg/varlinkapi/container.go | 4 |
17 files changed, 35 insertions, 17 deletions
diff --git a/pkg/api/handlers/compat/events.go b/pkg/api/handlers/compat/events.go index 61f895c29..289bf4a2d 100644 --- a/pkg/api/handlers/compat/events.go +++ b/pkg/api/handlers/compat/events.go @@ -17,7 +17,7 @@ import ( ) // filtersFromRequests extracts the "filters" parameter from the specified -// http.Request. The paramater can either be a `map[string][]string` as done +// http.Request. The parameter can either be a `map[string][]string` as done // in new versions of Docker and libpod, or a `map[string]map[string]bool` as // done in older versions of Docker. We have to do a bit of Yoga to support // both - just as Docker does as well. diff --git a/pkg/api/server/register_play.go b/pkg/api/server/register_play.go index a96f61099..9b27f36e4 100644 --- a/pkg/api/server/register_play.go +++ b/pkg/api/server/register_play.go @@ -24,7 +24,7 @@ func (s *APIServer) registerPlayHandlers(r *mux.Router) error { // name: tlsVerify // type: boolean // default: true - // description: Require HTTPS and verify signatures when contating registries. + // description: Require HTTPS and verify signatures when contacting registries. // - in: body // name: request // description: Kubernetes YAML file. diff --git a/pkg/auth/auth.go b/pkg/auth/auth.go index ffa65f7e5..69a7da869 100644 --- a/pkg/auth/auth.go +++ b/pkg/auth/auth.go @@ -126,7 +126,7 @@ func encodeMultiAuthConfigs(authConfigs map[string]types.DockerAuthConfig) (stri // one or more container registries. If tmpDir is empty, the system's default // TMPDIR will be used. func authConfigsToAuthFile(authConfigs map[string]types.DockerAuthConfig) (string, error) { - // Intitialize an empty temporary JSON file. + // Initialize an empty temporary JSON file. tmpFile, err := ioutil.TempFile("", "auth.json.") if err != nil { return "", err diff --git a/pkg/bindings/test/system_test.go b/pkg/bindings/test/system_test.go index 2b2fa9b7c..82e5c7541 100644 --- a/pkg/bindings/test/system_test.go +++ b/pkg/bindings/test/system_test.go @@ -119,7 +119,7 @@ var _ = Describe("Podman system", func() { // Alpine image should not be pruned as used by running container Expect(systemPruneResponse.ImagePruneReport.Report.Id). ToNot(ContainElement("docker.io/library/alpine:latest")) - // Though unsed volume is available it should not be pruned as flag set to false. + // Though unused volume is available it should not be pruned as flag set to false. Expect(len(systemPruneResponse.VolumePruneReport)).To(Equal(0)) }) diff --git a/pkg/domain/entities/engine.go b/pkg/domain/entities/engine.go index 6776d09e9..f23d964e5 100644 --- a/pkg/domain/entities/engine.go +++ b/pkg/domain/entities/engine.go @@ -46,6 +46,7 @@ type PodmanConfig struct { RegistriesConf string // allows for specifying a custom registries.conf Remote bool // Connection to Podman API Service will use RESTful API RuntimePath string // --runtime flag will set Engine.RuntimePath + RuntimeFlags []string // global flags for the container runtime Span opentracing.Span // tracing object SpanCloser io.Closer // Close() for tracing object SpanCtx context.Context // context to use when tracing diff --git a/pkg/domain/entities/play.go b/pkg/domain/entities/play.go index 0823bc64e..2ba369b83 100644 --- a/pkg/domain/entities/play.go +++ b/pkg/domain/entities/play.go @@ -32,7 +32,7 @@ type PlayKubePod struct { ID string // Containers - the IDs of the containers running in the created pod. Containers []string - // Logs - non-fatal erros and log messages while processing. + // Logs - non-fatal errors and log messages while processing. Logs []string } diff --git a/pkg/domain/infra/abi/manifest.go b/pkg/domain/infra/abi/manifest.go index 55f73bf65..672d0a69f 100644 --- a/pkg/domain/infra/abi/manifest.go +++ b/pkg/domain/infra/abi/manifest.go @@ -130,7 +130,7 @@ func (ir *ImageEngine) ManifestAdd(ctx context.Context, opts entities.ManifestAd func (ir *ImageEngine) ManifestAnnotate(ctx context.Context, names []string, opts entities.ManifestAnnotateOptions) (string, error) { listImage, err := ir.Libpod.ImageRuntime().NewFromLocal(names[0]) if err != nil { - return "", errors.Wrapf(err, "error retreiving local image from image name %s", names[0]) + return "", errors.Wrapf(err, "error retrieving local image from image name %s", names[0]) } digest, err := digest.Parse(names[1]) if err != nil { diff --git a/pkg/domain/infra/runtime_libpod.go b/pkg/domain/infra/runtime_libpod.go index a88347e24..f9b8106ef 100644 --- a/pkg/domain/infra/runtime_libpod.go +++ b/pkg/domain/infra/runtime_libpod.go @@ -156,6 +156,14 @@ func getRuntime(ctx context.Context, fs *flag.FlagSet, opts *engineOpts) (*libpo options = append(options, libpod.WithRenumber()) } + if len(cfg.RuntimeFlags) > 0 { + runtimeFlags := []string{} + for _, arg := range cfg.RuntimeFlags { + runtimeFlags = append(runtimeFlags, "--"+arg) + } + options = append(options, libpod.WithRuntimeFlags(runtimeFlags)) + } + // Only set this if the user changes storage config on the command line if storageSet { options = append(options, libpod.WithStorageConfig(storageOpts)) diff --git a/pkg/domain/infra/tunnel/containers.go b/pkg/domain/infra/tunnel/containers.go index 062b38a70..35550b9be 100644 --- a/pkg/domain/infra/tunnel/containers.go +++ b/pkg/domain/infra/tunnel/containers.go @@ -19,6 +19,7 @@ import ( "github.com/containers/podman/v2/pkg/bindings" "github.com/containers/podman/v2/pkg/bindings/containers" "github.com/containers/podman/v2/pkg/domain/entities" + "github.com/containers/podman/v2/pkg/errorhandling" "github.com/containers/podman/v2/pkg/specgen" "github.com/pkg/errors" "github.com/sirupsen/logrus" @@ -537,8 +538,8 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta // de-spaghetti the code. defer func() { if err := containers.Remove(ic.ClientCxt, con.ID, bindings.PFalse, bindings.PTrue); err != nil { - if errors.Cause(err) == define.ErrNoSuchCtr || - errors.Cause(err) == define.ErrCtrRemoved { + if errorhandling.Contains(err, define.ErrNoSuchCtr) || + errorhandling.Contains(err, define.ErrCtrRemoved) { logrus.Warnf("Container %s does not exist: %v", con.ID, err) } else { logrus.Errorf("Error removing container %s: %v", con.ID, err) @@ -556,7 +557,7 @@ func (ic *ContainerEngine) ContainerRun(ctx context.Context, opts entities.Conta // Determine why the wait failed. If the container doesn't exist, // consult the events. - if !strings.Contains(waitErr.Error(), define.ErrNoSuchCtr.Error()) { + if !errorhandling.Contains(waitErr, define.ErrNoSuchCtr) { return &report, waitErr } diff --git a/pkg/errorhandling/errorhandling.go b/pkg/errorhandling/errorhandling.go index 3117b0ca4..ca6b60bc5 100644 --- a/pkg/errorhandling/errorhandling.go +++ b/pkg/errorhandling/errorhandling.go @@ -57,3 +57,11 @@ func CloseQuiet(f *os.File) { logrus.Errorf("unable to close file %s: %q", f.Name(), err) } } + +// Contains checks if err's message contains sub's message. Contains should be +// used iff either err or sub has lost type information (e.g., due to +// marshaling). For typed errors, please use `errors.Contains(...)` or `Is()` +// in recent version of Go. +func Contains(err error, sub error) bool { + return strings.Contains(err.Error(), sub.Error()) +} diff --git a/pkg/network/netconflist_test.go b/pkg/network/netconflist_test.go index a82a0140a..5893bf985 100644 --- a/pkg/network/netconflist_test.go +++ b/pkg/network/netconflist_test.go @@ -28,7 +28,7 @@ func TestNewIPAMDefaultRoute(t *testing.T) { t.Run(tt.name, func(t *testing.T) { got, err := NewIPAMDefaultRoute(tt.isIPv6) if err != nil { - t.Errorf("no errorr expected: %v", err) + t.Errorf("no error expected: %v", err) } if !reflect.DeepEqual(got, tt.want) { t.Errorf("NewIPAMDefaultRoute() = %v, want %v", got, tt.want) diff --git a/pkg/network/network.go b/pkg/network/network.go index db625da56..c4c1ff67f 100644 --- a/pkg/network/network.go +++ b/pkg/network/network.go @@ -206,7 +206,7 @@ func InspectNetwork(config *config.Config, name string) (map[string]interface{}, } // Exists says whether a given network exists or not; it meant -// specifically for restful reponses so 404s can be used +// specifically for restful responses so 404s can be used func Exists(config *config.Config, name string) (bool, error) { _, err := ReadRawCNIConfByName(config, name) if err != nil { diff --git a/pkg/spec/spec.go b/pkg/spec/spec.go index 5e97620cc..42228540c 100644 --- a/pkg/spec/spec.go +++ b/pkg/spec/spec.go @@ -334,7 +334,7 @@ func (config *CreateConfig) createConfigToOCISpec(runtime *libpod.Runtime, userM } else { defaultEnv, err = env.ParseSlice(runtimeConfig.Containers.Env) if err != nil { - return nil, errors.Wrap(err, "Env fields in containers.conf failed ot parse") + return nil, errors.Wrap(err, "Env fields in containers.conf failed to parse") } defaultEnv = env.Join(env.DefaultEnvVariables(), defaultEnv) } diff --git a/pkg/specgen/generate/storage.go b/pkg/specgen/generate/storage.go index 182ae74a7..7f55317ff 100644 --- a/pkg/specgen/generate/storage.go +++ b/pkg/specgen/generate/storage.go @@ -46,7 +46,7 @@ func finalizeMounts(ctx context.Context, s *specgen.SpecGenerator, rt *libpod.Ru return nil, nil, err } - // Supercede from --volumes-from. + // Supersede from --volumes-from. for dest, mount := range volFromMounts { baseMounts[dest] = mount } diff --git a/pkg/util/utils_linux_test.go b/pkg/util/utils_linux_test.go index 38e6dbef9..aa193bbef 100644 --- a/pkg/util/utils_linux_test.go +++ b/pkg/util/utils_linux_test.go @@ -8,7 +8,7 @@ import ( ) func TestGetImageConfigStopSignal(t *testing.T) { - // Linux-only beause parsing signal names is not supported on non-Linux systems by + // Linux-only because parsing signal names is not supported on non-Linux systems by // pkg/signal. stopSignalValidInt, err := GetImageConfig([]string{"STOPSIGNAL 9"}) require.Nil(t, err) diff --git a/pkg/varlink/io.podman.varlink b/pkg/varlink/io.podman.varlink index 6240936d0..cd6316011 100644 --- a/pkg/varlink/io.podman.varlink +++ b/pkg/varlink/io.podman.varlink @@ -257,7 +257,7 @@ type InfoRegistry ( blocked: []string ) -# InfoStore describes the host's storage informatoin +# InfoStore describes the host's storage information type InfoStore ( containers: int, images: int, diff --git a/pkg/varlinkapi/container.go b/pkg/varlinkapi/container.go index bf3ed0022..c4e8c1feb 100644 --- a/pkg/varlinkapi/container.go +++ b/pkg/varlinkapi/container.go @@ -750,7 +750,7 @@ func portsToString(ports []ocicni.PortMapping) string { continue } } - // For each portMapKey, format group list and appned to output string. + // For each portMapKey, format group list and append to output string. for _, portKey := range groupKeyList { group := portGroupMap[portKey] portDisplay = append(portDisplay, formatGroup(portKey, group.first, group.last)) @@ -794,7 +794,7 @@ func GetRunlabel(label string, runlabelImage string, ctx context.Context, runtim return runLabel, imageName, err } -// GenerateRunlabelCommand generates the command that will eventually be execucted by Podman. +// GenerateRunlabelCommand generates the command that will eventually be executed by Podman. func GenerateRunlabelCommand(runLabel, imageName, name string, opts map[string]string, extraArgs []string, globalOpts string) ([]string, []string, error) { // If no name is provided, we use the image's basename instead. if name == "" { |