summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--RELEASE_NOTES.md18
-rw-r--r--changelog.txt48
-rwxr-xr-xcontrib/cirrus/check_image.sh3
-rw-r--r--contrib/cirrus/packer/fedora_setup.sh1
-rw-r--r--contrib/cirrus/packer/ubuntu_setup.sh1
-rw-r--r--contrib/snapcraft/.editorconfig17
-rw-r--r--contrib/snapcraft/.gitignore12
-rw-r--r--contrib/snapcraft/LICENSE21
-rw-r--r--contrib/snapcraft/README.md82
-rw-r--r--contrib/snapcraft/snap/snapcraft.yaml45
-rw-r--r--contrib/spec/podman.spec.in2
-rw-r--r--libpod/driver/driver.go4
-rw-r--r--libpod/events/journal_linux.go5
-rw-r--r--libpod/runtime_pod_infra_linux.go3
-rw-r--r--libpod/util_linux.go11
-rw-r--r--pkg/adapter/pods.go2
-rw-r--r--pkg/cgroups/cgroups.go73
-rw-r--r--pkg/cgroups/systemd.go23
-rw-r--r--pkg/hooks/hooks.go3
-rw-r--r--test/e2e/play_kube_test.go24
-rw-r--r--test/system/030-run.bats13
-rw-r--r--test/system/055-rm.bats42
-rw-r--r--version/version.go2
24 files changed, 431 insertions, 26 deletions
diff --git a/Makefile b/Makefile
index 4138586af..c4b66e261 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@ export GO111MODULE=off
GO ?= go
DESTDIR ?=
-EPOCH_TEST_COMMIT ?= bb80586e275fe0d3f47700ec54c9718a28b1e59c
+EPOCH_TEST_COMMIT ?= b9a176bea94b8e3a97a70dd7cd599f1a057777b0
HEAD ?= HEAD
CHANGELOG_BASE ?= HEAD~
CHANGELOG_TARGET ?= HEAD
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index f55fd9b18..3cfd8ed86 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -1,5 +1,23 @@
# Release Notes
+## 1.5.1
+### Features
+- The hostname of pods is now set to the pod's name
+
+### Bugfixes
+- Fixed a bug where `podman run` and `podman create` did not honor the `--authfile` option ([#3730](https://github.com/containers/libpod/issues/3730))
+- Fixed a bug where containers restored with `podman container restore --import` would incorrectly duplicate the Conmon PID file of the original container
+- Fixed a bug where `podman build` ignored the default OCI runtime configured in `libpod.conf`
+- Fixed a bug where `podman run --rm` (or force-removing any running container with `podman rm --force`) were not retrieving the correct exit code ([#3795](https://github.com/containers/libpod/issues/3795))
+- Fixed a bug where Podman would exit with an error if any configured hooks directory was not present
+- Fixed a bug where `podman inspect` and `podman commit` would not use the correct `CMD` for containers run with `podman play kube`
+- Fixed a bug created pods when using rootless Podman and CGroups V2 ([#3801](https://github.com/containers/libpod/issues/3801))
+- Fixed a bug where the `podman events` command with the `--since` or `--until` options could take a very long time to complete
+
+### Misc
+- Rootless Podman will now inherit OCI runtime configuration from the root configuration ([#3781](https://github.com/containers/libpod/issues/3781))
+- Podman now properly sets a user agent while contacting registries ([#3788](https://github.com/containers/libpod/issues/3788))
+
## 1.5.0
### Features
- Podman containers can now join the user namespaces of other containers with `--userns=container:$ID`, or a user namespace at an arbitary path with `--userns=ns:$PATH`
diff --git a/changelog.txt b/changelog.txt
index beea8dd5c..b0a847aee 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,51 @@
+- Changelog for v1.5.1 (2019-08-15)
+ * Add release notes for v1.5.1
+ * Set Pod hostname as Pod name
+ * tests for exit status on podman run --rm
+ * performance fix for podman events with large journalds
+ * pkg/cgroups: use DBUS session when rootless
+ * Fix play kube command in pod yaml
+ * removMergeDir from inspect result if not mounted
+ * Running Podman with a nonexistent hooks dir is nonfatal
+ * Cirrus: Install varlink on Ubuntu
+ * Cirrus: Install varlink on Fedora
+ * Add missing stage-packages in snapcraft.yaml.
+ * Add RHEL and SUSE to snap doc
+ * start groundwork for adding snap
+ * Add user systemd service and socket
+ * Small optimization - only store exit code when nonzero
+ * Fix container exit code with Journald backend
+ * Revert "Cirrus: Temp. workaround missing imgprune image"
+ * Homebrew installation in install.md
+ * varlink endpoint for containerstats requires root
+ * Adjust get_ci_vm.sh for substitution
+ * Cirrus: Add verification for cgroupv2 image
+ * Cirrus: Add experimental fedora VM image & test
+ * image: add user agent to Docker registry options
+ * Cirrus: Minor, use newer Ubuntu base image
+ * tests: disable some tests currently failing when not using runc
+ * containers: look also for 'file not found' in the error message
+ * cirrus: add tests with crun on Fedora 30
+ * rootless: cherry-pick runtime from the system configuration
+ * cirrus: install crun
+ * cmd: drop check for euid==0
+ * storage: drop unused geteuid check
+ * cmd, stats: fix check for rootless mode
+ * oci: drop check for euid==0
+ * build: use the configured runtime
+ * Adjust read count so that a newline can be added afterwards
+ * Fix incorrect use of realloc()
+ * Bump gitvalidation epoch
+ * Bump to v1.5.1-dev
+ * Fix a couple of errors descovered by coverity
+ * Test that restored container does not depend on the original container
+ * Fix up ConmonPidFile after restore
+ * Cirrus: Enable updates-testing repo for Fedora
+ * enable windows remote client
+ * implement 'make remotesystem'
+ * Squish a few tpyo nits in container.go doc
+ * Cirrus: Add Second partition for storage testing
+
- Changelog for v1.5.0 (2019-08-09)
* vendor github.com/containers/storage@v1.13.2
* Improve dns-search validation, empty domains now return an error
diff --git a/contrib/cirrus/check_image.sh b/contrib/cirrus/check_image.sh
index c8e8c4c63..ad9a12f49 100755
--- a/contrib/cirrus/check_image.sh
+++ b/contrib/cirrus/check_image.sh
@@ -22,6 +22,9 @@ item_test 'Minimum available memory' $MEM_FREE -ge $MIN_MEM_MB || let "NFAILS+=1
# binary anywhere; that could potentially taint our results.
item_test "remove_packaged_podman_files() did it's job" -z "$(type -P podman)" || let "NFAILS+=1"
+# Integration Tests require varlink in Fedora
+item_test "The varlink executable is present" -x "$(type -P varlink)" || let "NFAILS+=1"
+
MIN_ZIP_VER='3.0'
VER_RE='.+([[:digit:]]+\.[[:digit:]]+).+'
ACTUAL_VER=$(zip --version 2>&1 | egrep -m 1 "Zip$VER_RE" | sed -r -e "s/$VER_RE/\\1/")
diff --git a/contrib/cirrus/packer/fedora_setup.sh b/contrib/cirrus/packer/fedora_setup.sh
index f73df4182..0e1a82cc0 100644
--- a/contrib/cirrus/packer/fedora_setup.sh
+++ b/contrib/cirrus/packer/fedora_setup.sh
@@ -53,6 +53,7 @@ ooe.sh sudo dnf install -y \
libseccomp \
libseccomp-devel \
libselinux-devel \
+ libvarlink-util \
lsof \
make \
nmap-ncat \
diff --git a/contrib/cirrus/packer/ubuntu_setup.sh b/contrib/cirrus/packer/ubuntu_setup.sh
index 4b50d6dc3..00d92570f 100644
--- a/contrib/cirrus/packer/ubuntu_setup.sh
+++ b/contrib/cirrus/packer/ubuntu_setup.sh
@@ -65,6 +65,7 @@ $BIGTO $SUDOAPTGET install \
libnet1-dev \
libnl-3-dev \
libostree-dev \
+ libvarlink \
libprotobuf-c0-dev \
libprotobuf-dev \
libseccomp-dev \
diff --git a/contrib/snapcraft/.editorconfig b/contrib/snapcraft/.editorconfig
new file mode 100644
index 000000000..1749b2d4c
--- /dev/null
+++ b/contrib/snapcraft/.editorconfig
@@ -0,0 +1,17 @@
+root = true
+
+[*]
+indent_style = space
+indent_size = 4
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = false
+insert_final_newline = false
+
+[*.yaml]
+indent_style = space
+indent_size = 2
+end_of_line = lf
+charset = utf-8
+trim_trailing_whitespace = true
+insert_final_newline = true \ No newline at end of file
diff --git a/contrib/snapcraft/.gitignore b/contrib/snapcraft/.gitignore
new file mode 100644
index 000000000..59894f50f
--- /dev/null
+++ b/contrib/snapcraft/.gitignore
@@ -0,0 +1,12 @@
+#snapcraft specifics
+/parts/
+/stage/
+/prime/
+
+*.snap
+
+.snapcraft
+__pycache__
+*.pyc
+*_source.tar.bz2
+snap/.snapcraft
diff --git a/contrib/snapcraft/LICENSE b/contrib/snapcraft/LICENSE
new file mode 100644
index 000000000..81802d619
--- /dev/null
+++ b/contrib/snapcraft/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Snapcrafters
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/contrib/snapcraft/README.md b/contrib/snapcraft/README.md
new file mode 100644
index 000000000..f543c61a7
--- /dev/null
+++ b/contrib/snapcraft/README.md
@@ -0,0 +1,82 @@
+<h1 align="center">
+ <img src="https://raw.githubusercontent.com/containers/podman.io/master/images/podman.svg?sanitize=true" alt="podman">
+ <br />
+</h1>
+
+<p align="center"><b>This is the snap for <a href="https://podman.io/">podman</a></b>, <i>“Managing Pods, Containers, and Container Images in Multiple Formats (Docker, OCI, ...).”</i>. It works on Ubuntu, Fedora, Debian, RHEL, SUSE, and other major Linux
+distributions.</p>
+
+<!-- Uncomment and modify this when you are provided a build status badge
+<p align="center">
+<a href="https://build.snapcraft.io/user/snapcrafters/fork-and-rename-me"><img src="https://build.snapcraft.io/badge/snapcrafters/fork-and-rename-me.svg" alt="Snap Status"></a>
+</p>
+-->
+
+<!-- Uncomment and modify this when you have a screenshot
+![podman](screenshot.png?raw=true "podman")
+-->
+
+<p align="center">Published for <img src="https://raw.githubusercontent.com/anythingcodes/slack-emoji-for-techies/gh-pages/emoji/tux.png" align="top" width="24" /> with 💝 by Snapcrafters</p>
+
+## Install
+
+ sudo snap install podman
+
+([Don't have snapd installed?](https://snapcraft.io/docs/core/install))
+
+## Remaining tasks
+<!-- Uncomment and modify this when you have a screenshot
+![podman](screenshot.png?raw=true "podman")
+-->
+
+Snapcrafters ([join us](https://forum.snapcraft.io/t/join-snapcrafters/1325))
+are working to land snap install documentation and
+the [snapcraft.yaml](https://github.com/snapcrafters/podman/blob/master/snap/snapcraft.yaml)
+upstream so `podman` can authoritatively publish future releases.
+
+ - [x] Fork the [Snapcrafters template](https://github.com/snapcrafters/fork-and-rename-me) repository to your own GitHub account.
+ - If you have already forked the Snapcrafter template to your account and want to create another snap, you'll need to use GitHub's [Import repository](https://github.com/new/import) feature because you can only fork a repository once.
+ - [x] Rename the forked Snapcrafters template repository
+ - [x] Update the description of the repository
+ - [x] Update logos and references to `podman` and `[podman]`
+ - [ ] Create a snap that runs in `devmode`
+ - [x] Register the snap in the store, **using the preferred upstream name**
+ - [ ] Add a screenshot to this `README.md`
+ - [ ] Publish the `devmode` snap in the Snap store edge channel
+ - [ ] Add install instructions to this `README.md`
+ - [ ] Update snap store metadata, icons and screenshots
+ - [ ] Convert the snap to `strict` confinement, or `classic` confinement if it qualifies
+ - [ ] Publish the confined snap in the Snap store beta channel
+ - [ ] Update the install instructions in this `README.md`
+ - [ ] Post a call for testing on the [Snapcraft Forum](https://forum.snapcraft.io) - [link]()
+ - [ ] Make a post in the [Snapcraft Forum](https://forum.snapcraft.io) asking for a transfer of the snap name from you to snapcrafters - [link]()
+ - [ ] Ask a [Snapcrafters admin](https://github.com/orgs/snapcrafters/people?query=%20role%3Aowner) to fork your repo into github.com/snapcrafters, and configure the repo for automatic publishing into edge on commit
+ - [ ] Add the provided Snapcraft build badge to this `README.md`
+ - [ ] Publish the snap in the Snap store stable channel
+ - [ ] Update the install instructions in this `README.md`
+ - [ ] Post an announcement in the [Snapcraft Forum](https://forum.snapcraft.io) - [link]()
+ - [ ] Submit a pull request or patch upstream that adds snap install documentation - [link]()
+ - [ ] Submit a pull request or patch upstream that adds the `snapcraft.yaml` and any required assets/launchers - [link]()
+ - [ ] Add upstream contact information to the `README.md`
+ - If upstream accept the PR:
+ - [ ] Request upstream create a Snap store account
+ - [ ] Contact the Snap Advocacy team to request the snap be transferred to upstream
+ - [ ] Ask the Snap Advocacy team to celebrate the snap - [link]()
+
+If you have any questions, [post in the Snapcraft forum](https://forum.snapcraft.io).
+
+<!--
+## The Snapcrafters
+
+| [![Your Name](https://gravatar.com/avatar/bc0bced65e963eb5c3a16cab8b004431/?s=128)](https://github.com/yourname/) |
+| :---: |
+| [Your Name](https://github.com/yourname/) |
+-->
+
+<!-- Uncomment and modify this when you have upstream contacts
+## Upstream
+
+| [![Upstream Name](https://gravatar.com/avatar/bc0bced65e963eb5c3a16cab8b004431?s=128)](https://github.com/upstreamname) |
+| :---: |
+| [Upstream Name](https://github.com/upstreamname) |
+-->
diff --git a/contrib/snapcraft/snap/snapcraft.yaml b/contrib/snapcraft/snap/snapcraft.yaml
new file mode 100644
index 000000000..7ff0df03b
--- /dev/null
+++ b/contrib/snapcraft/snap/snapcraft.yaml
@@ -0,0 +1,45 @@
+name: podman # you probably want to 'snapcraft register <name>'
+version: '0.11.1.1' # just for humans, typically '1.2+git' or '1.3.2'
+summary: Manage pods, containers and container images
+description: |
+ `podman` is a tool for managing Pods, Containers, and Container Images
+ in multiple formats including Docker/OSI images. It exposes the same
+ command line interface as Docker, but runs containers unprivileged by
+ default.
+
+confinement: devmode # use 'strict' once you have the right plugs and slots
+
+base: core18
+
+parts:
+ podman:
+ plugin: go
+ source: https://github.com/containers/libpod/archive/v0.11.1.1.tar.gz
+ go-importpath: github.com/containers/libpod
+ build-packages:
+ # https://github.com/containers/libpod/blob/master/install.md#build-and-run-dependencies
+ - btrfs-tools
+ - git
+ - golang-go
+ - go-md2man
+ - iptables
+ - libassuan-dev
+ - libdevmapper-dev
+ - libglib2.0-dev
+ - libc6-dev
+ - libgpgme11-dev
+ - libgpg-error-dev
+ - libostree-dev
+ - libprotobuf-dev
+ - libprotobuf-c0-dev
+ - libseccomp-dev
+ - libselinux1-dev
+ - pkg-config
+ stage-packages:
+ - libarchive13
+ - libassuan0
+ - libgpgme11
+ - libicu60
+ - libostree-1-1
+ - libsoup2.4-1
+ - libxml2
diff --git a/contrib/spec/podman.spec.in b/contrib/spec/podman.spec.in
index 35f3b2014..934f785db 100644
--- a/contrib/spec/podman.spec.in
+++ b/contrib/spec/podman.spec.in
@@ -39,7 +39,7 @@
%global shortcommit_conmon %(c=%{commit_conmon}; echo ${c:0:7})
Name: podman
-Version: 1.5.1
+Version: 1.5.2
Release: #COMMITDATE#.git%{shortcommit0}%{?dist}
Summary: Manage Pods, Containers and Container Images
License: ASL 2.0
diff --git a/libpod/driver/driver.go b/libpod/driver/driver.go
index f9442fa21..85eda5a21 100644
--- a/libpod/driver/driver.go
+++ b/libpod/driver/driver.go
@@ -38,6 +38,10 @@ func GetDriverData(store cstorage.Store, layerID string) (*Data, error) {
if err != nil {
return nil, err
}
+ if mountTimes, err := store.Mounted(layerID); mountTimes == 0 || err != nil {
+ delete(metaData, "MergedDir")
+ }
+
return &Data{
Name: name,
Data: metaData,
diff --git a/libpod/events/journal_linux.go b/libpod/events/journal_linux.go
index 3bc3f6de7..470c76959 100644
--- a/libpod/events/journal_linux.go
+++ b/libpod/events/journal_linux.go
@@ -73,6 +73,11 @@ func (e EventJournalD) Read(options ReadOptions) error {
if err := j.SeekTail(); err != nil {
return errors.Wrap(err, "failed to seek end of journal")
}
+ } else {
+ podmanJournal := sdjournal.Match{Field: "SYSLOG_IDENTIFIER", Value: "podman"} //nolint
+ if err := j.AddMatch(podmanJournal.String()); err != nil {
+ return errors.Wrap(err, "failed to add filter for event log")
+ }
}
// the api requires a next|prev before getting a cursor
if _, err := j.Next(); err != nil {
diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go
index da35b7f93..24651099f 100644
--- a/libpod/runtime_pod_infra_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -30,6 +30,9 @@ func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, imgID
return nil, err
}
+ // Set Pod hostname as Pod name
+ g.Config.Hostname = p.config.Name
+
isRootless := rootless.IsRootless()
entryCmd := []string{r.config.InfraCommand}
diff --git a/libpod/util_linux.go b/libpod/util_linux.go
index 78cbc75a7..d5c113daf 100644
--- a/libpod/util_linux.go
+++ b/libpod/util_linux.go
@@ -48,6 +48,9 @@ func makeSystemdCgroup(path string) error {
return err
}
+ if rootless.IsRootless() {
+ return controller.CreateSystemdUserUnit(path, rootless.GetRootlessUID())
+ }
return controller.CreateSystemdUnit(path)
}
@@ -57,6 +60,14 @@ func deleteSystemdCgroup(path string) error {
if err != nil {
return err
}
+ if rootless.IsRootless() {
+ conn, err := cgroups.GetUserConnection(rootless.GetRootlessUID())
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
+ return controller.DeleteByPathConn(path, conn)
+ }
return controller.DeleteByPath(path)
}
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go
index e25238956..2743dfdc6 100644
--- a/pkg/adapter/pods.go
+++ b/pkg/adapter/pods.go
@@ -707,6 +707,8 @@ func kubeContainerToCreateConfig(ctx context.Context, containerYAML v1.Container
return nil, errors.Errorf("No command specified in container YAML or as CMD or ENTRYPOINT in this image for %s", containerConfig.Name)
}
+ containerConfig.UserCommand = containerConfig.Command
+
containerConfig.StopSignal = 15
// If the user does not pass in ID mappings, just set to basics
diff --git a/pkg/cgroups/cgroups.go b/pkg/cgroups/cgroups.go
index f2c6b548e..085718855 100644
--- a/pkg/cgroups/cgroups.go
+++ b/pkg/cgroups/cgroups.go
@@ -10,6 +10,8 @@ import (
"strconv"
"strings"
+ systemdDbus "github.com/coreos/go-systemd/dbus"
+ "github.com/godbus/dbus"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -352,7 +354,56 @@ func (c *CgroupControl) CreateSystemdUnit(path string) error {
if !c.systemd {
return fmt.Errorf("the cgroup controller is not using systemd")
}
- return systemdCreate(path)
+
+ conn, err := systemdDbus.New()
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
+
+ return systemdCreate(path, conn)
+}
+
+// GetUserConnection returns an user connection to D-BUS
+func GetUserConnection(uid int) (*systemdDbus.Conn, error) {
+ return systemdDbus.NewConnection(func() (*dbus.Conn, error) {
+ return dbusAuthConnection(uid, dbus.SessionBusPrivate)
+ })
+}
+
+// CreateSystemdUserUnit creates the systemd cgroup for the specified user
+func (c *CgroupControl) CreateSystemdUserUnit(path string, uid int) error {
+ if !c.systemd {
+ return fmt.Errorf("the cgroup controller is not using systemd")
+ }
+
+ conn, err := GetUserConnection(uid)
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
+
+ return systemdCreate(path, conn)
+}
+
+func dbusAuthConnection(uid int, createBus func(opts ...dbus.ConnOption) (*dbus.Conn, error)) (*dbus.Conn, error) {
+ conn, err := createBus()
+ if err != nil {
+ return nil, err
+ }
+
+ methods := []dbus.Auth{dbus.AuthExternal(strconv.Itoa(uid))}
+
+ err = conn.Auth(methods)
+ if err != nil {
+ conn.Close()
+ return nil, err
+ }
+ if err := conn.Hello(); err != nil {
+ return nil, err
+ }
+
+ return conn, nil
}
// Delete cleans a cgroup
@@ -386,10 +437,11 @@ func rmDirRecursively(path string) error {
return nil
}
-// DeleteByPath deletes the specified cgroup path
-func (c *CgroupControl) DeleteByPath(path string) error {
+// DeleteByPathConn deletes the specified cgroup path using the specified
+// dbus connection if needed.
+func (c *CgroupControl) DeleteByPathConn(path string, conn *systemdDbus.Conn) error {
if c.systemd {
- return systemdDestroy(path)
+ return systemdDestroyConn(path, conn)
}
if c.cgroup2 {
return rmDirRecursively(filepath.Join(cgroupRoot, c.path))
@@ -413,6 +465,19 @@ func (c *CgroupControl) DeleteByPath(path string) error {
return lastError
}
+// DeleteByPath deletes the specified cgroup path
+func (c *CgroupControl) DeleteByPath(path string) error {
+ if c.systemd {
+ conn, err := systemdDbus.New()
+ if err != nil {
+ return err
+ }
+ defer conn.Close()
+ return c.DeleteByPathConn(path, conn)
+ }
+ return c.DeleteByPathConn(path, nil)
+}
+
// Update updates the cgroups
func (c *CgroupControl) Update(resources *spec.LinuxResources) error {
for _, h := range handlers {
diff --git a/pkg/cgroups/systemd.go b/pkg/cgroups/systemd.go
index e72e456bc..b8e6db156 100644
--- a/pkg/cgroups/systemd.go
+++ b/pkg/cgroups/systemd.go
@@ -9,13 +9,7 @@ import (
"github.com/godbus/dbus"
)
-func systemdCreate(path string) error {
- c, err := systemdDbus.New()
- if err != nil {
- return err
- }
- defer c.Close()
-
+func systemdCreate(path string, c *systemdDbus.Conn) error {
slice, name := filepath.Split(path)
slice = strings.TrimSuffix(slice, "/")
@@ -43,7 +37,7 @@ func systemdCreate(path string) error {
}
ch := make(chan string)
- _, err = c.StartTransientUnit(name, "replace", properties, ch)
+ _, err := c.StartTransientUnit(name, "replace", properties, ch)
if err != nil {
lastError = err
continue
@@ -55,7 +49,7 @@ func systemdCreate(path string) error {
}
/*
- systemdDestroy is copied from containerd/cgroups/systemd.go file, that
+ systemdDestroyConn is copied from containerd/cgroups/systemd.go file, that
has the following license:
Copyright The containerd Authors.
@@ -72,18 +66,11 @@ func systemdCreate(path string) error {
See the License for the specific language governing permissions and
limitations under the License.
*/
-
-func systemdDestroy(path string) error {
- c, err := systemdDbus.New()
- if err != nil {
- return err
- }
- defer c.Close()
-
+func systemdDestroyConn(path string, c *systemdDbus.Conn) error {
name := filepath.Base(path)
ch := make(chan string)
- _, err = c.StopUnit(name, "replace", ch)
+ _, err := c.StopUnit(name, "replace", ch)
if err != nil {
return err
}
diff --git a/pkg/hooks/hooks.go b/pkg/hooks/hooks.go
index b962ffa5c..0d26bf4af 100644
--- a/pkg/hooks/hooks.go
+++ b/pkg/hooks/hooks.go
@@ -4,6 +4,7 @@ package hooks
import (
"context"
"fmt"
+ "os"
"sort"
"strings"
"sync"
@@ -56,7 +57,7 @@ func New(ctx context.Context, directories []string, extensionStages []string) (m
for _, dir := range directories {
err = ReadDir(dir, manager.extensionStages, manager.hooks)
- if err != nil {
+ if err != nil && !os.IsNotExist(err) {
return nil, err
}
}
diff --git a/test/e2e/play_kube_test.go b/test/e2e/play_kube_test.go
index 331412a39..b0a9f2ead 100644
--- a/test/e2e/play_kube_test.go
+++ b/test/e2e/play_kube_test.go
@@ -140,6 +140,30 @@ var _ = Describe("Podman generate kube", func() {
Expect(inspect.OutputToString()).To(ContainSubstring(ctrCmd[0]))
})
+ It("podman play kube test correct output", func() {
+ ctrName := "testCtr"
+ ctrCmd := []string{"echo", "hello"}
+ testContainer := Container{ctrCmd, ALPINE, ctrName, false, nil, nil}
+ tempFile := filepath.Join(podmanTest.TempDir, "kube.yaml")
+
+ err := generateKubeYaml([]Container{testContainer}, tempFile)
+ Expect(err).To(BeNil())
+
+ kube := podmanTest.Podman([]string{"play", "kube", tempFile})
+ kube.WaitWithDefaultTimeout()
+ Expect(kube.ExitCode()).To(Equal(0))
+
+ logs := podmanTest.Podman([]string{"logs", ctrName})
+ logs.WaitWithDefaultTimeout()
+ Expect(logs.ExitCode()).To(Equal(0))
+ Expect(logs.OutputToString()).To(ContainSubstring("hello"))
+
+ inspect := podmanTest.Podman([]string{"inspect", ctrName, "--format", "'{{ .Config.Cmd }}'"})
+ inspect.WaitWithDefaultTimeout()
+ Expect(inspect.ExitCode()).To(Equal(0))
+ Expect(inspect.OutputToString()).To(ContainSubstring("hello"))
+ })
+
It("podman play kube cap add", func() {
ctrName := "testCtr"
ctrCmd := []string{"cat", "/proc/self/status"}
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index cefff0e2c..9e609b434 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -43,4 +43,17 @@ echo $rand | 0 | $rand
is "$output" "" "unwanted /sys/kernel in 'mount' output (with --net=host)"
}
+# 'run --rm' goes through different code paths and may lose exit status.
+# See https://github.com/containers/libpod/issues/3795
+@test "podman run --rm" {
+ skip_if_remote "podman-remote does not handle exit codes"
+
+ run_podman 0 run --rm $IMAGE /bin/true
+ run_podman 1 run --rm $IMAGE /bin/false
+
+ # Believe it or not, 'sh -c' resulted in different behavior
+ run_podman 0 run --rm $IMAGE sh -c /bin/true
+ run_podman 1 run --rm $IMAGE sh -c /bin/false
+}
+
# vim: filetype=sh
diff --git a/test/system/055-rm.bats b/test/system/055-rm.bats
new file mode 100644
index 000000000..c13c8c52e
--- /dev/null
+++ b/test/system/055-rm.bats
@@ -0,0 +1,42 @@
+#!/usr/bin/env bats -*- bats -*-
+#
+# tests for podman rm
+#
+
+load helpers
+
+@test "podman rm" {
+ rand=$(random_string 30)
+ run_podman run --name $rand $IMAGE /bin/true
+
+ # Don't care about output, just check exit status (it should exist)
+ run_podman 0 inspect $rand
+
+ # container should be in output of 'ps -a'
+ run_podman ps -a
+ is "$output" ".* $IMAGE .*/true .* $rand" "Container present in 'ps -a'"
+
+ # Remove container; now 'inspect' should fail
+ run_podman rm $rand
+ run_podman 125 inspect $rand
+}
+
+# I'm sorry! This test takes 13 seconds. There's not much I can do about it,
+# please know that I think it's justified: podman 1.5.0 had a strange bug
+# in with exit status was not preserved on some code paths with 'rm -f'
+# or 'podman run --rm' (see also 030-run.bats). The test below is a bit
+# kludgy: what we care about is the exit status of the killed container,
+# not 'podman rm', but BATS has no provision (that I know of) for forking,
+# so what we do is start the 'rm' beforehand and monitor the exit status
+# of the 'sleep' container.
+#
+# See https://github.com/containers/libpod/issues/3795
+@test "podman rm -f" {
+ skip_if_remote "podman-remote does not handle exit codes"
+
+ rand=$(random_string 30)
+ ( sleep 3; run_podman rm -f $rand ) &
+ run_podman 137 run --name $rand $IMAGE sleep 30
+}
+
+# vim: filetype=sh
diff --git a/version/version.go b/version/version.go
index d5f91210e..f0823f260 100644
--- a/version/version.go
+++ b/version/version.go
@@ -4,7 +4,7 @@ package version
// NOTE: remember to bump the version at the top
// of the top-level README.md file when this is
// bumped.
-const Version = "1.5.1-dev"
+const Version = "1.5.2-dev"
// RemoteAPIVersion is the version for the remote
// client API. It is used to determine compatibility