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/abi/system.go | 70 | ||||
-rw-r--r-- | pkg/domain/infra/runtime_libpod.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.go | 24 | ||||
-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, 44 insertions, 87 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/abi/system.go b/pkg/domain/infra/abi/system.go index 914a7681d..57c098166 100644 --- a/pkg/domain/infra/abi/system.go +++ b/pkg/domain/infra/abi/system.go @@ -17,7 +17,6 @@ import ( "github.com/containers/podman/v2/pkg/rootless" "github.com/containers/podman/v2/pkg/util" "github.com/containers/podman/v2/utils" - "github.com/docker/distribution/reference" "github.com/pkg/errors" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -199,71 +198,32 @@ func (ic *ContainerEngine) SystemDf(ctx context.Context, options entities.System dfImages = []*entities.SystemDfImageReport{} ) - // Get Images and iterate them + // Compute disk-usage stats for all local images. imgs, err := ic.Libpod.ImageRuntime().GetImages() if err != nil { return nil, err } - for _, i := range imgs { - var sharedSize uint64 - cons, err := i.Containers() - if err != nil { - return nil, err - } - imageSize, err := i.Size(ctx) - if err != nil { - return nil, err - } - uniqueSize := *imageSize - parent, err := i.GetParent(ctx) - if err != nil { - return nil, err - } - if parent != nil { - parentSize, err := parent.Size(ctx) - if err != nil { - return nil, err - } - uniqueSize = *parentSize - *imageSize - sharedSize = *imageSize - uniqueSize - } - var name, repository, tag string - for _, n := range i.Names() { - if len(n) > 0 { - name = n - break - } - } - - if len(name) > 0 { - named, err := reference.ParseNormalizedNamed(name) - if err != nil { - return nil, err - } - repository = named.Name() - if tagged, isTagged := named.(reference.NamedTagged); isTagged { - tag = tagged.Tag() - } - } else { - repository = "<none>" - tag = "<none>" - } + imageStats, err := ic.Libpod.ImageRuntime().DiskUsage(ctx, imgs) + if err != nil { + return nil, err + } + for _, stat := range imageStats { report := entities.SystemDfImageReport{ - Repository: repository, - Tag: tag, - ImageID: i.ID(), - Created: i.Created(), - Size: int64(*imageSize), - SharedSize: int64(sharedSize), - UniqueSize: int64(uniqueSize), - Containers: len(cons), + Repository: stat.Repository, + Tag: stat.Tag, + ImageID: stat.ID, + Created: stat.Created, + Size: int64(stat.Size), + SharedSize: int64(stat.SharedSize), + UniqueSize: int64(stat.UniqueSize), + Containers: stat.Containers, } dfImages = append(dfImages, &report) } - // GetContainers and iterate them + // Get Containers and iterate them cons, err := ic.Libpod.GetAllContainers() if err != nil { return nil, err 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/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.go b/pkg/util/utils.go index 82282a549..7612d3012 100644 --- a/pkg/util/utils.go +++ b/pkg/util/utils.go @@ -537,33 +537,21 @@ func OpenExclusiveFile(path string) (*os.File, error) { return os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_EXCL, 0666) } -// PullType whether to pull new image -type PullType int +type PullType = config.PullPolicy -const ( +var ( // PullImageAlways always try to pull new image when create or run - PullImageAlways PullType = iota + PullImageAlways = config.PullImageAlways // PullImageMissing pulls image if it is not locally - PullImageMissing + PullImageMissing = config.PullImageMissing // PullImageNever will never pull new image - PullImageNever + PullImageNever = config.PullImageNever ) // ValidatePullType check if the pullType from CLI is valid and returns the valid enum type // if the value from CLI is invalid returns the error func ValidatePullType(pullType string) (PullType, error) { - switch pullType { - case "always": - return PullImageAlways, nil - case "missing", "IfNotPresent": - return PullImageMissing, nil - case "never": - return PullImageNever, nil - case "": - return PullImageMissing, nil - default: - return PullImageMissing, errors.Errorf("invalid pull type %q", pullType) - } + return config.ValidatePullPolicy(pullType) } // ExitCode reads the error message when failing to executing container process 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 == "" { |