summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/auto-update.go2
-rw-r--r--cmd/podman/containers/ps.go8
-rw-r--r--cmd/podman/root.go15
-rw-r--r--docs/source/markdown/podman-auto-update.1.md3
-rw-r--r--docs/source/markdown/podman.1.md4
-rw-r--r--go.mod1
-rw-r--r--go.sum2
-rw-r--r--libpod/define/errors.go4
-rw-r--r--libpod/pod_api.go12
-rw-r--r--pkg/domain/infra/abi/pods.go36
-rw-r--r--test/e2e/ps_test.go11
-rw-r--r--vendor/github.com/openshift/imagebuilder/builder.go2
-rw-r--r--vendor/github.com/openshift/imagebuilder/imagebuilder.spec2
-rw-r--r--vendor/github.com/openshift/imagebuilder/internals.go2
-rw-r--r--vendor/modules.txt2
15 files changed, 77 insertions, 29 deletions
diff --git a/cmd/podman/auto-update.go b/cmd/podman/auto-update.go
index 11433bc25..eed211ff1 100644
--- a/cmd/podman/auto-update.go
+++ b/cmd/podman/auto-update.go
@@ -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]",
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index d10cda609..188a8c03b 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -309,7 +309,13 @@ func (l psReporter) Status() string {
// Command returns the container command in string format
func (l psReporter) Command() string {
- return strings.Join(l.ListContainer.Command, " ")
+ command := strings.Join(l.ListContainer.Command, " ")
+ if !noTrunc {
+ if len(command) > 17 {
+ return command[0:17] + "..."
+ }
+ }
+ return command
}
// Size returns the rootfs and virtual sizes in human duration in
diff --git a/cmd/podman/root.go b/cmd/podman/root.go
index 45ca48c39..3bb45f806 100644
--- a/cmd/podman/root.go
+++ b/cmd/podman/root.go
@@ -128,6 +128,21 @@ func persistentPreRunE(cmd *cobra.Command, args []string) error {
return err
}
+ for _, env := range cfg.Engine.Env {
+ splitEnv := strings.SplitN(env, "=", 2)
+ if len(splitEnv) != 2 {
+ return fmt.Errorf("invalid environment variable for engine %s, valid configuration is KEY=value pair", env)
+ }
+ // skip if the env is already defined
+ if _, ok := os.LookupEnv(splitEnv[0]); ok {
+ logrus.Debugf("environment variable %s is already defined, skip the settings from containers.conf", splitEnv[0])
+ continue
+ }
+ if err := os.Setenv(splitEnv[0], splitEnv[1]); err != nil {
+ return err
+ }
+ }
+
if cmd.Flag("cpu-profile").Changed {
f, err := os.Create(cfg.CPUProfile)
if err != nil {
diff --git a/docs/source/markdown/podman-auto-update.1.md b/docs/source/markdown/podman-auto-update.1.md
index f37280cda..b6941362a 100644
--- a/docs/source/markdown/podman-auto-update.1.md
+++ b/docs/source/markdown/podman-auto-update.1.md
@@ -23,6 +23,9 @@ Note that `podman auto-update` relies on systemd and requires a fully-qualified
This enforcement is necessary to know which image to actually check and pull.
If an image ID was used, Podman would not know which image to check/pull anymore.
+Moreover, the systemd units are expected to be generated with `podman-generate-systemd --new`, or similar units that create new containers in order to run the updated images.
+Systemd units that start and stop a container cannot run a new image.
+
## OPTIONS
**--authfile**=*path*
diff --git a/docs/source/markdown/podman.1.md b/docs/source/markdown/podman.1.md
index ce02ef3a7..c45c10243 100644
--- a/docs/source/markdown/podman.1.md
+++ b/docs/source/markdown/podman.1.md
@@ -123,6 +123,10 @@ NOTE --tmpdir is not used for the temporary storage of downloaded images. Use t
Print the version
+## Environment Variables
+
+Podman can set up environment variables from env of [engine] table in containers.conf. These variables can be overridden by passing environment variables before the `podman` commands.
+
## Exit Status
The exit code from `podman` gives information about why the container
diff --git a/go.mod b/go.mod
index fbd3f4ae7..bdb9e87e6 100644
--- a/go.mod
+++ b/go.mod
@@ -43,6 +43,7 @@ require (
github.com/opencontainers/runtime-spec v1.0.3-0.20200520003142-237cc4f519e2
github.com/opencontainers/runtime-tools v0.9.0
github.com/opencontainers/selinux v1.5.2
+ github.com/openshift/imagebuilder v1.1.6 // indirect
github.com/opentracing/opentracing-go v1.2.0
github.com/pkg/errors v0.9.1
github.com/pmezard/go-difflib v1.0.0
diff --git a/go.sum b/go.sum
index 9f1040318..e4d14069c 100644
--- a/go.sum
+++ b/go.sum
@@ -344,6 +344,8 @@ github.com/opencontainers/selinux v1.5.2 h1:F6DgIsjgBIcDksLW4D5RG9bXok6oqZ3nvMwj
github.com/opencontainers/selinux v1.5.2/go.mod h1:yTcKuYAh6R95iDpefGLQaPaRwJFwyzAJufJyiTt7s0g=
github.com/openshift/imagebuilder v1.1.5 h1:WAIHV6cGF9e0AcLBA7RIi7XbFoB7R+e/MWu1I+1NUOM=
github.com/openshift/imagebuilder v1.1.5/go.mod h1:9aJRczxCH0mvT6XQ+5STAQaPWz7OsWcU5/mRkt8IWeo=
+github.com/openshift/imagebuilder v1.1.6 h1:1+YzRxIIefY4QqtCImx6rg+75QrKNfBoPAKxgMo/khM=
+github.com/openshift/imagebuilder v1.1.6/go.mod h1:9aJRczxCH0mvT6XQ+5STAQaPWz7OsWcU5/mRkt8IWeo=
github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs=
github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc=
github.com/ostreedev/ostree-go v0.0.0-20190702140239-759a8c1ac913 h1:TnbXhKzrTOyuvWrjI8W6pcoI9XPbLHFXCdN2dtUw7Rw=
diff --git a/libpod/define/errors.go b/libpod/define/errors.go
index 98dc603d1..200c7e3d4 100644
--- a/libpod/define/errors.go
+++ b/libpod/define/errors.go
@@ -70,6 +70,10 @@ var (
// ErrInternal indicates an internal library error
ErrInternal = errors.New("internal libpod error")
+ // ErrPodPartialFail indicates that a pod operation was only partially
+ // successful, and some containers within the pod failed.
+ ErrPodPartialFail = errors.New("some containers failed")
+
// ErrDetach indicates that an attach session was manually detached by
// the user.
ErrDetach = utils.ErrDetach
diff --git a/libpod/pod_api.go b/libpod/pod_api.go
index 98f4cad73..c65890d66 100644
--- a/libpod/pod_api.go
+++ b/libpod/pod_api.go
@@ -59,7 +59,7 @@ func (p *Pod) Start(ctx context.Context) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error starting some containers")
+ return ctrErrors, errors.Wrapf(define.ErrPodPartialFail, "error starting some containers")
}
defer p.newPodEvent(events.Start)
return nil, nil
@@ -139,7 +139,7 @@ func (p *Pod) StopWithTimeout(ctx context.Context, cleanup bool, timeout int) (m
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error stopping some containers")
+ return ctrErrors, errors.Wrapf(define.ErrPodPartialFail, "error stopping some containers")
}
defer p.newPodEvent(events.Stop)
return nil, nil
@@ -208,7 +208,7 @@ func (p *Pod) Pause() (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error pausing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrPodPartialFail, "error pausing some containers")
}
defer p.newPodEvent(events.Pause)
return nil, nil
@@ -267,7 +267,7 @@ func (p *Pod) Unpause() (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error unpausing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrPodPartialFail, "error unpausing some containers")
}
defer p.newPodEvent(events.Unpause)
@@ -321,7 +321,7 @@ func (p *Pod) Restart(ctx context.Context) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error stopping some containers")
+ return ctrErrors, errors.Wrapf(define.ErrPodPartialFail, "error stopping some containers")
}
p.newPodEvent(events.Stop)
p.newPodEvent(events.Start)
@@ -387,7 +387,7 @@ func (p *Pod) Kill(signal uint) (map[string]error, error) {
}
if len(ctrErrors) > 0 {
- return ctrErrors, errors.Wrapf(define.ErrCtrExists, "error killing some containers")
+ return ctrErrors, errors.Wrapf(define.ErrPodPartialFail, "error killing some containers")
}
defer p.newPodEvent(events.Kill)
return nil, nil
diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go
index 4a122f54d..055a37b3e 100644
--- a/pkg/domain/infra/abi/pods.go
+++ b/pkg/domain/infra/abi/pods.go
@@ -67,14 +67,14 @@ func (ic *ContainerEngine) PodKill(ctx context.Context, namesOrIds []string, opt
for _, p := range pods {
report := entities.PodKillReport{Id: p.ID()}
conErrs, err := p.Kill(uint(sig))
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
report.Errs = []error{err}
reports = append(reports, &report)
continue
}
if len(conErrs) > 0 {
- for _, err := range conErrs {
- report.Errs = append(report.Errs, err)
+ for id, err := range conErrs {
+ report.Errs = append(report.Errs, errors.Wrapf(err, "error killing container %s", id))
}
reports = append(reports, &report)
continue
@@ -93,13 +93,13 @@ func (ic *ContainerEngine) PodPause(ctx context.Context, namesOrIds []string, op
for _, p := range pods {
report := entities.PodPauseReport{Id: p.ID()}
errs, err := p.Pause()
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
report.Errs = []error{err}
continue
}
if len(errs) > 0 {
- for _, v := range errs {
- report.Errs = append(report.Errs, v)
+ for id, v := range errs {
+ report.Errs = append(report.Errs, errors.Wrapf(v, "error pausing container %s", id))
}
reports = append(reports, &report)
continue
@@ -118,13 +118,13 @@ func (ic *ContainerEngine) PodUnpause(ctx context.Context, namesOrIds []string,
for _, p := range pods {
report := entities.PodUnpauseReport{Id: p.ID()}
errs, err := p.Unpause()
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
report.Errs = []error{err}
continue
}
if len(errs) > 0 {
- for _, v := range errs {
- report.Errs = append(report.Errs, v)
+ for id, v := range errs {
+ report.Errs = append(report.Errs, errors.Wrapf(v, "error unpausing container %s", id))
}
reports = append(reports, &report)
continue
@@ -143,13 +143,13 @@ func (ic *ContainerEngine) PodStop(ctx context.Context, namesOrIds []string, opt
for _, p := range pods {
report := entities.PodStopReport{Id: p.ID()}
errs, err := p.StopWithTimeout(ctx, false, options.Timeout)
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
report.Errs = []error{err}
continue
}
if len(errs) > 0 {
- for _, v := range errs {
- report.Errs = append(report.Errs, v)
+ for id, v := range errs {
+ report.Errs = append(report.Errs, errors.Wrapf(v, "error stopping container %s", id))
}
reports = append(reports, &report)
continue
@@ -168,14 +168,14 @@ func (ic *ContainerEngine) PodRestart(ctx context.Context, namesOrIds []string,
for _, p := range pods {
report := entities.PodRestartReport{Id: p.ID()}
errs, err := p.Restart(ctx)
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
report.Errs = []error{err}
reports = append(reports, &report)
continue
}
if len(errs) > 0 {
- for _, v := range errs {
- report.Errs = append(report.Errs, v)
+ for id, v := range errs {
+ report.Errs = append(report.Errs, errors.Wrapf(v, "error restarting container %s", id))
}
reports = append(reports, &report)
continue
@@ -195,14 +195,14 @@ func (ic *ContainerEngine) PodStart(ctx context.Context, namesOrIds []string, op
for _, p := range pods {
report := entities.PodStartReport{Id: p.ID()}
errs, err := p.Start(ctx)
- if err != nil {
+ if err != nil && errors.Cause(err) != define.ErrPodPartialFail {
report.Errs = []error{err}
reports = append(reports, &report)
continue
}
if len(errs) > 0 {
- for _, v := range errs {
- report.Errs = append(report.Errs, v)
+ for id, v := range errs {
+ report.Errs = append(report.Errs, errors.Wrapf(v, "error starting container %s", id))
}
reports = append(reports, &report)
continue
diff --git a/test/e2e/ps_test.go b/test/e2e/ps_test.go
index cfc0a415e..5277e2200 100644
--- a/test/e2e/ps_test.go
+++ b/test/e2e/ps_test.go
@@ -466,4 +466,15 @@ var _ = Describe("Podman ps", func() {
Expect(ps.ExitCode()).To(Equal(0))
Expect(ps.OutputToString()).To(ContainSubstring("0.0.0.0:8080->80/tcp"))
})
+
+ It("podman ps truncate long create commad", func() {
+ session := podmanTest.Podman([]string{"run", ALPINE, "echo", "very", "long", "create", "command"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.ExitCode()).To(Equal(0))
+
+ session = podmanTest.Podman([]string{"ps", "-a"})
+ session.WaitWithDefaultTimeout()
+ Expect(session.OutputToString()).To(ContainSubstring("echo very long cr..."))
+ })
+
})
diff --git a/vendor/github.com/openshift/imagebuilder/builder.go b/vendor/github.com/openshift/imagebuilder/builder.go
index ffc3b257f..583c303c0 100644
--- a/vendor/github.com/openshift/imagebuilder/builder.go
+++ b/vendor/github.com/openshift/imagebuilder/builder.go
@@ -334,7 +334,7 @@ func ParseFile(path string) (*parser.Node, error) {
func (b *Builder) Step() *Step {
argsMap := make(map[string]string)
for _, argsVal := range b.Arguments() {
- val := strings.Split(argsVal, "=")
+ val := strings.SplitN(argsVal, "=", 2)
if len(val) > 1 {
argsMap[val[0]] = val[1]
}
diff --git a/vendor/github.com/openshift/imagebuilder/imagebuilder.spec b/vendor/github.com/openshift/imagebuilder/imagebuilder.spec
index 3b32403a7..b8680bd10 100644
--- a/vendor/github.com/openshift/imagebuilder/imagebuilder.spec
+++ b/vendor/github.com/openshift/imagebuilder/imagebuilder.spec
@@ -12,7 +12,7 @@
#
%global golang_version 1.8.1
-%{!?version: %global version 1.1.5}
+%{!?version: %global version 1.1.6}
%{!?release: %global release 1}
%global package_name imagebuilder
%global product_name Container Image Builder
diff --git a/vendor/github.com/openshift/imagebuilder/internals.go b/vendor/github.com/openshift/imagebuilder/internals.go
index b652dc1c7..5dc174bf7 100644
--- a/vendor/github.com/openshift/imagebuilder/internals.go
+++ b/vendor/github.com/openshift/imagebuilder/internals.go
@@ -103,7 +103,7 @@ func makeUserArgs(bEnv []string, bArgs map[string]string) (userArgs []string) {
userArgs = bEnv
envMap := make(map[string]string)
for _, envVal := range bEnv {
- val := strings.Split(envVal, "=")
+ val := strings.SplitN(envVal, "=", 2)
if len(val) > 1 {
envMap[val[0]] = val[1]
}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 74408b3cb..12f44afea 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -431,7 +431,7 @@ github.com/opencontainers/runtime-tools/validate
github.com/opencontainers/selinux/go-selinux
github.com/opencontainers/selinux/go-selinux/label
github.com/opencontainers/selinux/pkg/pwalk
-# github.com/openshift/imagebuilder v1.1.5
+# github.com/openshift/imagebuilder v1.1.6
github.com/openshift/imagebuilder
github.com/openshift/imagebuilder/dockerfile/command
github.com/openshift/imagebuilder/dockerfile/parser