diff options
Diffstat (limited to 'cmd/podman')
-rw-r--r-- | cmd/podman/common/create_opts.go | 11 | ||||
-rw-r--r-- | cmd/podman/containers/ps.go | 6 | ||||
-rw-r--r-- | cmd/podman/registry/registry.go | 3 | ||||
-rw-r--r-- | cmd/podman/system/service.go | 17 | ||||
-rw-r--r-- | cmd/podman/system/varlink.go | 61 |
5 files changed, 8 insertions, 90 deletions
diff --git a/cmd/podman/common/create_opts.go b/cmd/podman/common/create_opts.go index 6dc43dbc6..41611d1aa 100644 --- a/cmd/podman/common/create_opts.go +++ b/cmd/podman/common/create_opts.go @@ -211,12 +211,6 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup mounts = append(mounts, mount) } - // volumes - volumes := make([]string, 0, len(cc.Config.Volumes)) - for v := range cc.Config.Volumes { - volumes = append(volumes, v) - } - // dns dns := make([]net.IP, 0, len(cc.HostConfig.DNS)) for _, d := range cc.HostConfig.DNS { @@ -373,7 +367,6 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup UserNS: string(cc.HostConfig.UsernsMode), UTS: string(cc.HostConfig.UTSMode), Mount: mounts, - Volume: volumes, VolumesFrom: cc.HostConfig.VolumesFrom, Workdir: cc.Config.WorkingDir, Net: &netInfo, @@ -388,6 +381,10 @@ func ContainerCreateToContainerCLIOpts(cc handlers.CreateContainerConfig, cgroup } } + // volumes + if volumes := cc.HostConfig.Binds; len(volumes) > 0 { + cliOpts.Volume = volumes + } if len(cc.HostConfig.BlkioWeightDevice) > 0 { devices := make([]string, 0, len(cc.HostConfig.BlkioWeightDevice)) for _, d := range cc.HostConfig.BlkioWeightDevice { diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go index 6f84cf9b8..5d08e6163 100644 --- a/cmd/podman/containers/ps.go +++ b/cmd/podman/containers/ps.go @@ -144,7 +144,7 @@ func checkFlags(c *cobra.Command) error { func jsonOut(responses []entities.ListContainer) error { r := make([]entities.ListContainer, 0) for _, con := range responses { - con.CreatedAt = units.HumanDuration(time.Since(time.Unix(con.Created, 0))) + " ago" + con.CreatedAt = units.HumanDuration(time.Since(con.Created)) + " ago" con.Status = psReporter{con}.Status() r = append(r, con) } @@ -404,12 +404,12 @@ func (l psReporter) Ports() string { // CreatedAt returns the container creation time in string format. podman // and docker both return a timestamped value for createdat func (l psReporter) CreatedAt() string { - return time.Unix(l.Created, 0).String() + return l.Created.String() } // CreateHuman allows us to output the created time in human readable format func (l psReporter) CreatedHuman() string { - return units.HumanDuration(time.Since(time.Unix(l.Created, 0))) + " ago" + return units.HumanDuration(time.Since(l.Created)) + " ago" } // Cgroup exposes .Namespaces.Cgroup diff --git a/cmd/podman/registry/registry.go b/cmd/podman/registry/registry.go index 9c0b290e7..481ed810f 100644 --- a/cmd/podman/registry/registry.go +++ b/cmd/podman/registry/registry.go @@ -18,9 +18,6 @@ const DefaultRootAPIPath = "/run/podman/podman.sock" // DefaultRootAPIAddress is the default address of the REST socket with unix: prefix const DefaultRootAPIAddress = "unix:" + DefaultRootAPIPath -// DefaultVarlinkAddress is the default address of the varlink socket -const DefaultVarlinkAddress = "unix:/run/podman/io.podman" - type CliCommand struct { Mode []entities.EngineMode Command *cobra.Command diff --git a/cmd/podman/system/service.go b/cmd/podman/system/service.go index 78062d135..42482b5d9 100644 --- a/cmd/podman/system/service.go +++ b/cmd/podman/system/service.go @@ -38,7 +38,6 @@ Enable a listening service for API access to Podman commands. srvArgs = struct { Timeout int64 - Varlink bool }{} ) @@ -55,9 +54,6 @@ func init() { flags.Int64VarP(&srvArgs.Timeout, timeFlagName, "t", 5, "Time until the service session expires in seconds. Use 0 to disable the timeout") _ = srvCmd.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone) - flags.BoolVar(&srvArgs.Varlink, "varlink", false, "Use legacy varlink service instead of REST. Unit of --time changes from seconds to milliseconds.") - - _ = flags.MarkDeprecated("varlink", "valink API is deprecated.") flags.SetNormalizeFunc(aliasTimeoutFlag) } @@ -97,11 +93,6 @@ func service(cmd *cobra.Command, args []string) error { Command: cmd, } - if srvArgs.Varlink { - opts.Timeout = time.Duration(srvArgs.Timeout) * time.Millisecond - return registry.ContainerEngine().VarlinkService(registry.GetContext(), opts) - } - opts.Timeout = time.Duration(srvArgs.Timeout) * time.Second return restService(opts, cmd.Flags(), registry.PodmanConfig()) } @@ -111,8 +102,7 @@ func resolveAPIURI(_url []string) (string, error) { // 1) User input wins always // 2) systemd socket activation // 3) rootless honors XDG_RUNTIME_DIR - // 4) if varlink -- adapter.DefaultVarlinkAddress - // 5) lastly adapter.DefaultAPIAddress + // 4) lastly adapter.DefaultAPIAddress if len(_url) == 0 { if v, found := os.LookupEnv("PODMAN_SOCKET"); found { @@ -134,16 +124,11 @@ func resolveAPIURI(_url []string) (string, error) { } socketName := "podman.sock" - if srvArgs.Varlink { - socketName = "io.podman" - } socketPath := filepath.Join(xdg, "podman", socketName) if err := os.MkdirAll(filepath.Dir(socketPath), 0700); err != nil { return "", err } return "unix:" + socketPath, nil - case srvArgs.Varlink: - return registry.DefaultVarlinkAddress, nil default: if err := os.MkdirAll(filepath.Dir(registry.DefaultRootAPIPath), 0700); err != nil { return "", err diff --git a/cmd/podman/system/varlink.go b/cmd/podman/system/varlink.go deleted file mode 100644 index 363ac9cca..000000000 --- a/cmd/podman/system/varlink.go +++ /dev/null @@ -1,61 +0,0 @@ -// +build linux,!remote - -package system - -import ( - "time" - - "github.com/containers/common/pkg/completion" - "github.com/containers/podman/v2/cmd/podman/registry" - "github.com/containers/podman/v2/pkg/domain/entities" - "github.com/spf13/cobra" -) - -var ( - varlinkDescription = `Run varlink interface. Podman varlink listens on the specified unix domain socket for incoming connects. - - Tools speaking varlink protocol can remotely manage pods, containers and images. -` - varlinkCmd = &cobra.Command{ - Use: "varlink [options] [URI]", - Args: cobra.MinimumNArgs(1), - Short: "Run varlink interface", - Long: varlinkDescription, - RunE: varlinkE, - ValidArgsFunction: completion.AutocompleteDefault, - Deprecated: "Please see 'podman system service' for RESTful APIs", - Hidden: true, - Example: `podman varlink unix:/run/podman/io.podman - podman varlink --time 5000 unix:/run/podman/io.podman`, - } - varlinkArgs = struct { - Timeout int64 - }{} -) - -func init() { - registry.Commands = append(registry.Commands, registry.CliCommand{ - Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode}, - Command: varlinkCmd, - }) - flags := varlinkCmd.Flags() - - timeFlagName := "time" - flags.Int64VarP(&varlinkArgs.Timeout, timeFlagName, "t", 1000, "Time until the varlink session expires in milliseconds. Use 0 to disable the timeout") - _ = varlinkCmd.RegisterFlagCompletionFunc(timeFlagName, completion.AutocompleteNone) - - flags.SetNormalizeFunc(aliasTimeoutFlag) -} - -func varlinkE(cmd *cobra.Command, args []string) error { - uri := registry.DefaultVarlinkAddress - if len(args) > 0 { - uri = args[0] - } - opts := entities.ServiceOptions{ - URI: uri, - Timeout: time.Duration(varlinkArgs.Timeout) * time.Second, - Command: cmd, - } - return registry.ContainerEngine().VarlinkService(registry.GetContext(), opts) -} |