summaryrefslogtreecommitdiff
path: root/cmd/podman/shared
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/podman/shared')
-rw-r--r--cmd/podman/shared/container.go3
-rw-r--r--cmd/podman/shared/create.go1
-rw-r--r--cmd/podman/shared/events.go115
-rw-r--r--cmd/podman/shared/intermediate.go1
-rw-r--r--cmd/podman/shared/intermediate_varlink.go2
5 files changed, 6 insertions, 116 deletions
diff --git a/cmd/podman/shared/container.go b/cmd/podman/shared/container.go
index e14276bdf..9050fd2b9 100644
--- a/cmd/podman/shared/container.go
+++ b/cmd/podman/shared/container.go
@@ -658,7 +658,8 @@ func GetCtrInspectInfo(config *libpod.ContainerConfig, ctrInspectData *inspect.C
OomKillDisable: memDisableOOMKiller,
PidsLimit: pidsLimit,
Privileged: config.Privileged,
- ReadonlyRootfs: spec.Root.Readonly,
+ ReadOnlyRootfs: spec.Root.Readonly,
+ ReadOnlyTmpfs: createArtifact.ReadOnlyTmpfs,
Runtime: config.OCIRuntime,
NetworkMode: string(createArtifact.NetMode),
IpcMode: string(createArtifact.IpcMode),
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go
index 3f54e193f..c521f9cb6 100644
--- a/cmd/podman/shared/create.go
+++ b/cmd/podman/shared/create.go
@@ -650,6 +650,7 @@ func ParseCreateOpts(ctx context.Context, c *GenericCLIResults, runtime *libpod.
PortBindings: portBindings,
Quiet: c.Bool("quiet"),
ReadOnlyRootfs: c.Bool("read-only"),
+ ReadOnlyTmpfs: c.Bool("read-only-tmpfs"),
Resources: cc.CreateResourceConfig{
BlkioWeight: blkioWeight,
BlkioWeightDevice: c.StringSlice("blkio-weight-device"),
diff --git a/cmd/podman/shared/events.go b/cmd/podman/shared/events.go
deleted file mode 100644
index c62044271..000000000
--- a/cmd/podman/shared/events.go
+++ /dev/null
@@ -1,115 +0,0 @@
-package shared
-
-import (
- "fmt"
- "strings"
- "time"
-
- "github.com/containers/libpod/libpod/events"
- "github.com/containers/libpod/pkg/util"
- "github.com/pkg/errors"
-)
-
-func generateEventFilter(filter, filterValue string) (func(e *events.Event) bool, error) {
- switch strings.ToUpper(filter) {
- case "CONTAINER":
- return func(e *events.Event) bool {
- if e.Type != events.Container {
- return false
- }
- if e.Name == filterValue {
- return true
- }
- return strings.HasPrefix(e.ID, filterValue)
- }, nil
- case "EVENT", "STATUS":
- return func(e *events.Event) bool {
- return fmt.Sprintf("%s", e.Status) == filterValue
- }, nil
- case "IMAGE":
- return func(e *events.Event) bool {
- if e.Type != events.Image {
- return false
- }
- if e.Name == filterValue {
- return true
- }
- return strings.HasPrefix(e.ID, filterValue)
- }, nil
- case "POD":
- return func(e *events.Event) bool {
- if e.Type != events.Pod {
- return false
- }
- if e.Name == filterValue {
- return true
- }
- return strings.HasPrefix(e.ID, filterValue)
- }, nil
- case "VOLUME":
- return func(e *events.Event) bool {
- if e.Type != events.Volume {
- return false
- }
- return strings.HasPrefix(e.ID, filterValue)
- }, nil
- case "TYPE":
- return func(e *events.Event) bool {
- return fmt.Sprintf("%s", e.Type) == filterValue
- }, nil
- }
- return nil, errors.Errorf("%s is an invalid filter", filter)
-}
-
-func generateEventSinceOption(timeSince time.Time) func(e *events.Event) bool {
- return func(e *events.Event) bool {
- return e.Time.After(timeSince)
- }
-}
-
-func generateEventUntilOption(timeUntil time.Time) func(e *events.Event) bool {
- return func(e *events.Event) bool {
- return e.Time.Before(timeUntil)
-
- }
-}
-
-func parseFilter(filter string) (string, string, error) {
- filterSplit := strings.Split(filter, "=")
- if len(filterSplit) != 2 {
- return "", "", errors.Errorf("%s is an invalid filter", filter)
- }
- return filterSplit[0], filterSplit[1], nil
-}
-
-func GenerateEventOptions(filters []string, since, until string) ([]events.EventFilter, error) {
- var options []events.EventFilter
- for _, filter := range filters {
- key, val, err := parseFilter(filter)
- if err != nil {
- return nil, err
- }
- funcFilter, err := generateEventFilter(key, val)
- if err != nil {
- return nil, err
- }
- options = append(options, funcFilter)
- }
-
- if len(since) > 0 {
- timeSince, err := util.ParseInputTime(since)
- if err != nil {
- return nil, errors.Wrapf(err, "unable to convert since time of %s", since)
- }
- options = append(options, generateEventSinceOption(timeSince))
- }
-
- if len(until) > 0 {
- timeUntil, err := util.ParseInputTime(until)
- if err != nil {
- return nil, errors.Wrapf(err, "unable to convert until time of %s", until)
- }
- options = append(options, generateEventUntilOption(timeUntil))
- }
- return options, nil
-}
diff --git a/cmd/podman/shared/intermediate.go b/cmd/podman/shared/intermediate.go
index 2e1827561..9c494dec5 100644
--- a/cmd/podman/shared/intermediate.go
+++ b/cmd/podman/shared/intermediate.go
@@ -434,6 +434,7 @@ func NewIntermediateLayer(c *cliconfig.PodmanCommand, remote bool) GenericCLIRes
m["publish-all"] = newCRBool(c, "publish-all")
m["quiet"] = newCRBool(c, "quiet")
m["read-only"] = newCRBool(c, "read-only")
+ m["read-only-tmpfs"] = newCRBool(c, "read-only-tmpfs")
m["restart"] = newCRString(c, "restart")
m["rm"] = newCRBool(c, "rm")
m["rootfs"] = newCRBool(c, "rootfs")
diff --git a/cmd/podman/shared/intermediate_varlink.go b/cmd/podman/shared/intermediate_varlink.go
index d62a65955..5e21245e3 100644
--- a/cmd/podman/shared/intermediate_varlink.go
+++ b/cmd/podman/shared/intermediate_varlink.go
@@ -141,6 +141,7 @@ func (g GenericCLIResults) MakeVarlink() iopodman.Create {
PublishAll: BoolToPtr(g.Find("publish-all")),
Quiet: BoolToPtr(g.Find("quiet")),
Readonly: BoolToPtr(g.Find("read-only")),
+ Readonlytmpfs: BoolToPtr(g.Find("read-only-tmpfs")),
Restart: StringToPtr(g.Find("restart")),
Rm: BoolToPtr(g.Find("rm")),
Rootfs: BoolToPtr(g.Find("rootfs")),
@@ -397,6 +398,7 @@ func VarlinkCreateToGeneric(opts iopodman.Create) GenericCLIResults {
m["publish-all"] = boolFromVarlink(opts.PublishAll, "publish-all", false)
m["quiet"] = boolFromVarlink(opts.Quiet, "quiet", false)
m["read-only"] = boolFromVarlink(opts.Readonly, "read-only", false)
+ m["read-only-tmpfs"] = boolFromVarlink(opts.Readonlytmpfs, "read-only-tmpfs", true)
m["restart"] = stringFromVarlink(opts.Restart, "restart", nil)
m["rm"] = boolFromVarlink(opts.Rm, "rm", false)
m["rootfs"] = boolFromVarlink(opts.Rootfs, "rootfs", false)