Skip to content

Commit

Permalink
Merge pull request containers#6871 from mheon/202_backports
Browse files Browse the repository at this point in the history
Backports for v2.0.2
  • Loading branch information
openshift-merge-robot authored Jul 6, 2020
2 parents b8ad7f2 + 2fb9bb2 commit e3e2b1e
Show file tree
Hide file tree
Showing 102 changed files with 939 additions and 565 deletions.
19 changes: 19 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Release Notes

## 2.0.2
### Bugfixes
- Fixed a bug where the `podman ps` command would not truncate long container commands, resulting in display issues as the column could become extremely wide (the `--no-trunc` flag can be used to print the full command).
- Fixed a bug where `podman pod` commands operationg on multiple containers (e.g. `podman pod stop` and `podman pod kill`) would not print errors from individual containers, but only a warning that some containers had failed.
- Fixed a bug where the `podman system service` command would panic if a connection to the Events endpoint hung up early ([#6805](https://github.com/containers/libpod/issues/6805)).
- Fixed a bug where rootless Podman would create anonymous and named volumes with the wrong owner for containers run with the `--user` directive.
- Fixed a bug where the `TMPDIR` environment variable was not being defaulted (if unset) to `/var/tmp`.
- Fixed a bug where the `--publish` flag to `podman create` and `podman run` required that a host port be specified if an IP address was given ([#6806](https://github.com/containers/libpod/issues/6806)).
- Fixed a bug where in `podman-remote` commands performing an attach (`podman run`, `podman attach`, `podman start --attach`, `podman exec`) did not properly configure the terminal on Windows.
- Fixed a bug where the `--remote` flag to Podman required an argument, despite being a boolean ([#6704](https://github.com/containers/libpod/issues/6704)).
- Fixed a bug where the `podman generate systemd --new` command could generate incorrect unit files for a pod if a container in the pod was created using the `--pod=...` flag (with an =, instead of a space, before the pod ID) ([#6766](https://github.com/containers/libpod/issues/6766)).
- Fixed a bug where `NPROC` and `NOFILE` rlimits could be improperly set for rootless Podman containers

### API
- Fixed a bug where the timestamp format for Libpod image list endpoint was incorrect - the format has been switched to Unix time.
- Fixed a bug where the compatability Create endpoint did not handle empty entrypoints properly.
- Fixed a bug where the compatibility network remove endpoint would improperly handle errors where the network was not found
- Fixed a bug where containers would be created with improper permissions because of a umask issue ([#6787](https://github.com/containers/libpod/issues/6787))

## 2.0.1
### Changes
- The `podman system connection` command was mistakenly omitted from the 2.0 release, and has been included here.
Expand Down
2 changes: 2 additions & 0 deletions cmd/podman/auto-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ var (
autoUpdateDescription = `Auto update containers according to their auto-update policy.
Auto-update policies are specified with the "io.containers.autoupdate" label.
Containers are expected to run in systemd units created with "podman-generate-systemd --new",
or similar units that create new containers in order to run the updated images.
Note that this command is experimental. Please refer to the podman-auto-update(1) man page for details.`
autoUpdateCommand = &cobra.Command{
Use: "auto-update [flags]",
Expand Down
26 changes: 14 additions & 12 deletions cmd/podman/common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,24 @@ func parseSplitPort(hostIP, hostPort *string, ctrPort string, protocol *string)
}
if hostPort != nil {
if *hostPort == "" {
return newPort, errors.Errorf("must provide a non-empty container host port to publish")
}
hostStart, hostLen, err := parseAndValidateRange(*hostPort)
if err != nil {
return newPort, errors.Wrapf(err, "error parsing host port")
}
if hostLen != ctrLen {
return newPort, errors.Errorf("host and container port ranges have different lengths: %d vs %d", hostLen, ctrLen)
// Set 0 as a placeholder. The server side of Specgen
// will find a random, open, unused port to use.
newPort.HostPort = 0
} else {
hostStart, hostLen, err := parseAndValidateRange(*hostPort)
if err != nil {
return newPort, errors.Wrapf(err, "error parsing host port")
}
if hostLen != ctrLen {
return newPort, errors.Errorf("host and container port ranges have different lengths: %d vs %d", hostLen, ctrLen)
}
newPort.HostPort = hostStart
}
newPort.HostPort = hostStart
} else {
newPort.HostPort = newPort.ContainerPort
}

hport := newPort.HostPort
if hport == 0 {
hport = newPort.ContainerPort
}
logrus.Debugf("Adding port mapping from %d to %d length %d protocol %q", hport, newPort.ContainerPort, newPort.Range, newPort.Protocol)

return newPort, nil
Expand Down
14 changes: 6 additions & 8 deletions cmd/podman/containers/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,33 +44,31 @@ func attachFlags(flags *pflag.FlagSet) {
flags.StringVar(&attachOpts.DetachKeys, "detach-keys", containerConfig.DetachKeys(), "Select the key sequence for detaching a container. Format is a single character `[a-Z]` or a comma separated sequence of `ctrl-<value>`, where `<value>` is one of: `a-z`, `@`, `^`, `[`, `\\`, `]`, `^` or `_`")
flags.BoolVar(&attachOpts.NoStdin, "no-stdin", false, "Do not attach STDIN. The default is false")
flags.BoolVar(&attachOpts.SigProxy, "sig-proxy", true, "Proxy received signals to the process")
flags.BoolVarP(&attachOpts.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
if registry.IsRemote() {
_ = flags.MarkHidden("latest")
}
}

func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: attachCommand,
})
flags := attachCommand.Flags()
attachFlags(flags)
attachFlags(attachCommand.Flags())
validate.AddLatestFlag(attachCommand, &attachOpts.Latest)

registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerAttachCommand,
Parent: containerCmd,
})
containerAttachFlags := containerAttachCommand.Flags()
attachFlags(containerAttachFlags)
attachFlags(containerAttachCommand.Flags())
validate.AddLatestFlag(containerAttachCommand, &attachOpts.Latest)

}

func attach(cmd *cobra.Command, args []string) error {
if len(args) > 1 || (len(args) == 0 && !attachOpts.Latest) {
return errors.Errorf("attach requires the name or id of one running container or the latest flag")
}

var name string
if len(args) > 0 {
name = args[0]
Expand Down
9 changes: 3 additions & 6 deletions cmd/podman/containers/checkpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

"github.com/containers/libpod/v2/cmd/podman/parse"
"github.com/containers/libpod/v2/cmd/podman/registry"
"github.com/containers/libpod/v2/cmd/podman/utils"
"github.com/containers/libpod/v2/cmd/podman/validate"
"github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/containers/libpod/v2/pkg/rootless"
"github.com/pkg/errors"
Expand All @@ -25,7 +25,7 @@ var (
Long: checkpointDescription,
RunE: checkpoint,
Args: func(cmd *cobra.Command, args []string) error {
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman container checkpoint --keep ctrID
podman container checkpoint --all
Expand All @@ -48,12 +48,9 @@ func init() {
flags.BoolVarP(&checkpointOptions.LeaveRunning, "leave-running", "R", false, "Leave the container running after writing checkpoint to disk")
flags.BoolVar(&checkpointOptions.TCPEstablished, "tcp-established", false, "Checkpoint a container with established TCP connections")
flags.BoolVarP(&checkpointOptions.All, "all", "a", false, "Checkpoint all running containers")
flags.BoolVarP(&checkpointOptions.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.StringVarP(&checkpointOptions.Export, "export", "e", "", "Export the checkpoint image to a tar.gz")
flags.BoolVar(&checkpointOptions.IgnoreRootFS, "ignore-rootfs", false, "Do not include root file-system changes when exporting")
if registry.IsRemote() {
_ = flags.MarkHidden("latest")
}
validate.AddLatestFlag(checkpointCommand, &checkpointOptions.Latest)
}

func checkpoint(cmd *cobra.Command, args []string) error {
Expand Down
7 changes: 3 additions & 4 deletions cmd/podman/containers/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package containers
import (
"fmt"

"github.com/containers/libpod/v2/cmd/podman/parse"
"github.com/containers/libpod/v2/cmd/podman/registry"
"github.com/containers/libpod/v2/cmd/podman/utils"
"github.com/containers/libpod/v2/cmd/podman/validate"
"github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand All @@ -24,7 +24,7 @@ var (
Long: cleanupDescription,
RunE: cleanup,
Args: func(cmd *cobra.Command, args []string) error {
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman container cleanup --latest
podman container cleanup ctrID1 ctrID2 ctrID3
Expand All @@ -44,11 +44,10 @@ func init() {
})
flags := cleanupCommand.Flags()
flags.BoolVarP(&cleanupOptions.All, "all", "a", false, "Cleans up all containers")
flags.BoolVarP(&cleanupOptions.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.StringVar(&cleanupOptions.Exec, "exec", "", "Clean up the given exec session instead of the container")
flags.BoolVar(&cleanupOptions.Remove, "rm", false, "After cleanup, remove the container entirely")
flags.BoolVar(&cleanupOptions.RemoveImage, "rmi", false, "After cleanup, remove the image entirely")

validate.AddLatestFlag(cleanupCommand, &cleanupOptions.Latest)
}

func cleanup(cmd *cobra.Command, args []string) error {
Expand Down
1 change: 1 addition & 0 deletions cmd/podman/containers/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func createFlags(flags *pflag.FlagSet) {
flags.AddFlagSet(common.GetCreateFlags(&cliVals))
flags.AddFlagSet(common.GetNetFlags())
flags.SetNormalizeFunc(common.AliasFlags)

if registry.IsRemote() {
_ = flags.MarkHidden("authfile")
_ = flags.MarkHidden("env-host")
Expand Down
9 changes: 3 additions & 6 deletions cmd/podman/containers/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ var (
diffCmd = &cobra.Command{
Use: "diff [flags] CONTAINER",
Args: validate.IDOrLatestArgs,
Short: "Inspect changes on container's file systems",
Long: `Displays changes on a container filesystem. The container will be compared to its parent layer.`,
Short: "Inspect changes to the container's file systems",
Long: `Displays changes to the container filesystem's'. The container will be compared to its parent layer.`,
RunE: diff,
Example: `podman container diff myCtr
podman container diff -l --format json myCtr`,
Expand All @@ -35,10 +35,7 @@ func init() {
flags.BoolVar(&diffOpts.Archive, "archive", true, "Save the diff as a tar archive")
_ = flags.MarkHidden("archive")
flags.StringVar(&diffOpts.Format, "format", "", "Change the output format")

if !registry.IsRemote() {
flags.BoolVarP(&diffOpts.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
}
validate.AddLatestFlag(diffCmd, &diffOpts.Latest)
}

func diff(cmd *cobra.Command, args []string) error {
Expand Down
15 changes: 7 additions & 8 deletions cmd/podman/containers/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"os"

"github.com/containers/libpod/v2/cmd/podman/registry"
"github.com/containers/libpod/v2/cmd/podman/validate"
"github.com/containers/libpod/v2/libpod/define"
"github.com/containers/libpod/v2/pkg/domain/entities"
envLib "github.com/containers/libpod/v2/pkg/env"
Expand Down Expand Up @@ -53,14 +54,13 @@ func execFlags(flags *pflag.FlagSet) {
flags.StringArrayVarP(&envInput, "env", "e", []string{}, "Set environment variables")
flags.StringSliceVar(&envFile, "env-file", []string{}, "Read in a file of environment variables")
flags.BoolVarP(&execOpts.Interactive, "interactive", "i", false, "Keep STDIN open even if not attached")
flags.BoolVarP(&execOpts.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
flags.BoolVar(&execOpts.Privileged, "privileged", false, "Give the process extended Linux capabilities inside the container. The default is false")
flags.BoolVarP(&execOpts.Tty, "tty", "t", false, "Allocate a pseudo-TTY. The default is false")
flags.StringVarP(&execOpts.User, "user", "u", "", "Sets the username or UID used and optionally the groupname or GID for the specified command")
flags.UintVar(&execOpts.PreserveFDs, "preserve-fds", 0, "Pass N additional file descriptors to the container")
flags.StringVarP(&execOpts.WorkDir, "workdir", "w", "", "Working directory inside the container")

if registry.IsRemote() {
_ = flags.MarkHidden("latest")
_ = flags.MarkHidden("preserve-fds")
}
}
Expand All @@ -70,20 +70,19 @@ func init() {
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: execCommand,
})
flags := execCommand.Flags()
execFlags(flags)
execFlags(execCommand.Flags())
validate.AddLatestFlag(execCommand, &execOpts.Latest)

registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerExecCommand,
Parent: containerCmd,
})

containerExecFlags := containerExecCommand.Flags()
execFlags(containerExecFlags)
execFlags(containerExecCommand.Flags())
validate.AddLatestFlag(containerExecCommand, &execOpts.Latest)
}

func exec(cmd *cobra.Command, args []string) error {
func exec(_ *cobra.Command, args []string) error {
var nameOrID string

if len(args) == 0 && !execOpts.Latest {
Expand Down
11 changes: 4 additions & 7 deletions cmd/podman/containers/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package containers
import (
"fmt"

"github.com/containers/libpod/v2/cmd/podman/parse"
"github.com/containers/libpod/v2/cmd/podman/registry"
"github.com/containers/libpod/v2/cmd/podman/utils"
"github.com/containers/libpod/v2/cmd/podman/validate"
"github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
Expand All @@ -20,7 +20,7 @@ var (
Long: initDescription,
RunE: initContainer,
Args: func(cmd *cobra.Command, args []string) error {
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman init --latest
podman init 3c45ef19d893
Expand All @@ -45,10 +45,6 @@ var (

func initFlags(flags *pflag.FlagSet) {
flags.BoolVarP(&initOptions.All, "all", "a", false, "Initialize all containers")
flags.BoolVarP(&initOptions.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
if registry.IsRemote() {
_ = flags.MarkHidden("latest")
}
}

func init() {
Expand All @@ -58,15 +54,16 @@ func init() {
})
flags := initCommand.Flags()
initFlags(flags)
validate.AddLatestFlag(initCommand, &initOptions.Latest)

registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Parent: containerCmd,
Command: containerInitCommand,
})

containerInitFlags := containerInitCommand.Flags()
initFlags(containerInitFlags)
validate.AddLatestFlag(containerInitCommand, &initOptions.Latest)
}

func initContainer(cmd *cobra.Command, args []string) error {
Expand Down
3 changes: 2 additions & 1 deletion cmd/podman/containers/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package containers
import (
"github.com/containers/libpod/v2/cmd/podman/inspect"
"github.com/containers/libpod/v2/cmd/podman/registry"
"github.com/containers/libpod/v2/cmd/podman/validate"
"github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -30,7 +31,7 @@ func init() {
flags := inspectCmd.Flags()
flags.BoolVarP(&inspectOpts.Size, "size", "s", false, "Display total file size")
flags.StringVarP(&inspectOpts.Format, "format", "f", "json", "Format the output to a Go template or json")
flags.BoolVarP(&inspectOpts.Latest, "latest", "l", false, "Act on the latest container Podman is aware of")
validate.AddLatestFlag(inspectCmd, &inspectOpts.Latest)
}

func inspectExec(cmd *cobra.Command, args []string) error {
Expand Down
21 changes: 8 additions & 13 deletions cmd/podman/containers/kill.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"errors"
"fmt"

"github.com/containers/libpod/v2/cmd/podman/parse"
"github.com/containers/libpod/v2/cmd/podman/registry"
"github.com/containers/libpod/v2/cmd/podman/utils"
"github.com/containers/libpod/v2/cmd/podman/validate"
"github.com/containers/libpod/v2/pkg/domain/entities"
"github.com/containers/libpod/v2/pkg/signal"
"github.com/spf13/cobra"
Expand All @@ -22,7 +22,7 @@ var (
Long: killDescription,
RunE: kill,
Args: func(cmd *cobra.Command, args []string) error {
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
Example: `podman kill mywebserver
podman kill 860a4b23
Expand All @@ -31,7 +31,7 @@ var (

containerKillCommand = &cobra.Command{
Args: func(cmd *cobra.Command, args []string) error {
return parse.CheckAllLatestAndCIDFile(cmd, args, false, false)
return validate.CheckAllLatestAndCIDFile(cmd, args, false, false)
},
Use: killCommand.Use,
Short: killCommand.Short,
Expand All @@ -50,31 +50,26 @@ var (
func killFlags(flags *pflag.FlagSet) {
flags.BoolVarP(&killOptions.All, "all", "a", false, "Signal all running containers")
flags.StringVarP(&killOptions.Signal, "signal", "s", "KILL", "Signal to send to the container")
flags.BoolVarP(&killOptions.Latest, "latest", "l", false, "Act on the latest container podman is aware of")
if registry.IsRemote() {
_ = flags.MarkHidden("latest")
}
}

func init() {
registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: killCommand,
})
flags := killCommand.Flags()
killFlags(flags)
killFlags(killCommand.Flags())
validate.AddLatestFlag(killCommand, &killOptions.Latest)

registry.Commands = append(registry.Commands, registry.CliCommand{
Mode: []entities.EngineMode{entities.ABIMode, entities.TunnelMode},
Command: containerKillCommand,
Parent: containerCmd,
})

containerKillFlags := containerKillCommand.Flags()
killFlags(containerKillFlags)
killFlags(containerKillCommand.Flags())
validate.AddLatestFlag(containerKillCommand, &killOptions.Latest)
}

func kill(cmd *cobra.Command, args []string) error {
func kill(_ *cobra.Command, args []string) error {
var (
err error
errs utils.OutputErrors
Expand Down
1 change: 1 addition & 0 deletions cmd/podman/containers/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ func init() {
Parent: containerCmd,
})
listFlagSet(listCmd.Flags())
validate.AddLatestFlag(listCmd, &listOpts.Latest)
}
Loading

0 comments on commit e3e2b1e

Please sign in to comment.