Commit graph

672 commits

Author SHA1 Message Date
Giuseppe Scrivano 71410ff073
images: empty list is valid json with --format=json
similar change to f7d55d64e7

with images --format=json, be sure the output is valid json also when
it is an empty list.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-11 21:56:40 +02:00
OpenShift Merge Robot b0b3506621
Merge pull request #4238 from giuseppe/rootless-enable-ps-size-tests
tests: enable ps --size tests for rootless
2019-10-11 21:30:25 +02:00
OpenShift Merge Robot eb6ca054fc
Merge pull request #4237 from giuseppe/ps-not-null
container: initialize results list
2019-10-11 18:53:26 +02:00
Giuseppe Scrivano c731131c86
tests: enable ps --size tests for rootless
rootless podman is using a single user namespace for all the containers
so it can safely access the storage for all of them.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-11 17:19:52 +02:00
Giuseppe Scrivano f7d55d64e7
container: initialize results list
it solves:

$ podman ps --format=json
null

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-11 16:52:18 +02:00
OpenShift Merge Robot fd389d28ce
Merge pull request #4206 from giuseppe/systemd-mode-look-full-path
systemd: expect full path /usr/sbin/init
2019-10-10 14:58:41 -07:00
OpenShift Merge Robot cec8edd6f5
Merge pull request #4181 from cevich/start_test_slower_poll
Raise start_test polling interval
2019-10-10 14:58:34 -07:00
Giuseppe Scrivano 3ba3e1c751
systemd: expect full path /usr/sbin/init
"init" is a quite common name for the command executed in a container
image and Podman ends up using the systemd mode also when not
required.

Be stricter on enabling the systemd mode and not enable it
automatically when the basename is "init" but expect the full path
"/usr/sbin/init".

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-10-09 23:38:45 +02:00
Mrigank Krishan c5e26f8e40 podman network create: validate user input
Disallow invalid/confusing names such as '../bar' or 'foo '
Closes #4184

Signed-off-by: Mrigank Krishan <mrigankkrishan@gmail.com>
2019-10-04 02:34:01 +05:30
Chris Evich 584c70a9f8
Raise start_test polling interval
According to the documentation
https://onsi.github.io/gomega/#eventually

> the default value for the polling interval is 10 milliseconds

That is excessively fast given the observed failures in
issue #4021 are always using podman-remote.  Lower the interval to
3-seconds, which should be plenty long enough for container removal.

Signed-off-by: Chris Evich <cevich@redhat.com>
2019-10-03 12:08:36 -04:00
OpenShift Merge Robot 2c23729c84
Merge pull request #4001 from kunalkushwaha/podman-import-fix
podman import syntax fix
2019-09-30 07:20:09 -07:00
OpenShift Merge Robot 01a802e546
Merge pull request #4118 from cevich/fix_sig_proxy
Move noCache logic lower in stack
2019-09-27 23:21:25 -07:00
OpenShift Merge Robot d4399eebb9
Merge pull request #4121 from jwhonce/issue/4021
Change ginkgo Wait() to Eventually() test
2019-09-27 20:09:17 +02:00
Kunal Kushwaha 039b44ea11 new testcase for podman import --change added
Signed-off-by: Kunal Kushwaha <kunal.kushwaha@gmail.com>
2019-09-27 17:17:12 +09:00
Nalin Dahyabhai 65b20bd521 Correct use of reexec.Init()
A true result from reexec.Init() isn't an error, but it indicates that
main() should exit with a success exit status.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-09-26 18:19:07 -04:00
Jhon Honce f4723beac6 Change ginkgo Wait() to Eventually() test
Changing the test in WaitWithDefaultTimeout() to use Eventually() and
gexec.Exit(). Using ExitCode() before command has really exited returns
a -1, which can cause issues for tests testing for podman to return
non-zero values.

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-09-26 14:11:54 -07:00
Chris Evich 437d9d2cde
Move noCache logic lower in stack
One or more tests are not taking advantage of the local image cache.
This has been observed to cause a testing flake in at least one
`--sigproxy` test which uses `PodmanTestIntegration.PodmanPID()`.
It has a rather short timeout of 15-seconds, which isn't always
enough time to pull down a remote image.

Fix this by reloacing the `noCache` logic from
`PodmanTest.PodmanAsUserBase()` down the stack into
`PodmanTestIntegration.makeOptions()`.  This also eliminates the need to
also check if a remote-client is being used - since it uses a different
function.

Also reverse the parameter order in `PodmanTest.PodmanBase` so that
everywhere is consistently `noEvents` then `noCache`.

Signed-off-by: Chris Evich <cevich@redhat.com>
2019-09-26 10:56:24 -04:00
Qi Wang 0144c3796b fix cp none exists dest path ends with '/'
close #3894
This patch let podman cp return 'no such file or directory' error if DEST_PATH does not exist and ends with / when copying file.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-09-25 12:48:05 -04:00
Matthew Heon d89414b1f0 Handle conflict between volumes and --read-only-tmpfs
When a named volume is mounted on any of the tmpfs filesystems
created by read-only tmpfs, it caused a conflict that was not
resolved prior to this.

Fixes BZ1755119

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-24 15:57:17 -04:00
gabi beyer 65d5a9823e add list mount tests
Add two unit tests to determine whether mounts are being listed
correctly. One tests that a created container is not listed
until mounted. The second checks that running containers are
mounted, and then no longer listed as mounted when they stop
running. The final test creates three containers, mounts two,
and checks that mount correctly only lists the two mounted.

Signed-off-by: gabi beyer <gabrielle.n.beyer@intel.com>
2019-09-24 11:01:28 +02:00
Giuseppe Scrivano fb353f6f42
execuser: look at the source for /etc/{passwd,group} overrides
look if there are bind mounts that can shadow the /etc/passwd and
/etc/group files.  In that case, look at the bind mount source.

Closes: https://github.com/containers/libpod/pull/4068#issuecomment-533782941

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-09-21 22:11:09 +02:00
Giuseppe Scrivano e42e1c45ae
container: make sure $HOME is always set
If the HOME environment variable is not set, make sure it is set to
the configuration found in the container /etc/passwd file.

It was previously depending on a runc behavior that always set HOME
when it is not set.  The OCI runtime specifications do not require
HOME to be set so move the logic to libpod.

Closes: https://github.com/debarshiray/toolbox/issues/266

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-09-20 16:01:38 +02:00
Daniel J Walsh 34d22a4e5c
Fix exit code failure
Be less precise on the exit code and lot the exit code to the journal when it fails.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-09-17 12:01:02 -04:00
OpenShift Merge Robot 42e080bcd3
Merge pull request #4043 from haircommander/preserve-fd-fix
exec: fix --preserve-fds
2019-09-16 23:23:59 +02:00
OpenShift Merge Robot 2a4e062c71
Merge pull request #3941 from gabibeyer/fix_unit_test
fix unit test using strings.Contains
2019-09-16 22:24:05 +02:00
Peter Hunt 5f97721afc exec: fix --preserve-fds
There were two problems with preserve fds.
libpod didn't open the fds before passing _OCI*PIPE to conmon. This caused libpod to talk on the preserved fds, rather than the pipes, with conmon talking on the pipes. This caused a hang.
Libpod also didn't convert an int to string correctly, so it would further fail.

Fix these and add a unit test to make sure we don't regress in the future

Note: this test will not pass on crun until crun supports --preserve-fds

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-09-16 15:27:00 -04:00
OpenShift Merge Robot 7875e00c66
Merge pull request #3934 from rhatdan/wait
Podman-remote run should wait for exit code
2019-09-13 18:12:25 +02:00
Jhon Honce a6836eae52 Do not support wildcards on cp
* symlink processing and wildcarding led to unexpected files
  being copied

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2019-09-12 16:56:38 -07:00
gabi beyer 69c58236ae fix unit test to use Expect
The Expect function does not return a result of True or False
depending on the value of the first instance, but instead requires
a comparison using ".To(", so change to use ".To(ContainSubstring("

Signed-off-by: gabi beyer <gabrielle.n.beyer@intel.com>
2019-09-12 21:01:43 +00:00
Daniel J Walsh 82ac0d8925
Podman-remote run should wait for exit code
This change matches what is happening on the podman local side
and should eliminate a race condition.

Also exit commands on the server side should start to return to client.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-09-12 16:20:01 -04:00
Daniel J Walsh 535111b5d5
Use exit code constants
We have leaked the exit number codess all over the code, this patch
removes the numbers to constants.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-09-12 16:20:01 -04:00
Debarshi Ray 137ec81634 Test that PTYs created by 'podman exec --tty' have the ONLCR flag
Signed-off-by: Debarshi Ray <rishi@fedoraproject.org>
2019-09-12 18:34:56 +02:00
OpenShift Merge Robot 9cf852c305
Merge pull request #3927 from openSUSE/manager-annotations
Add `ContainerManager` annotation to created containers
2019-09-11 09:34:14 +02:00
OpenShift Merge Robot 7ac6ed3b4b
Merge pull request #3581 from mheon/no_cgroups
Support running containers without CGroups
2019-09-11 00:58:46 +02:00
OpenShift Merge Robot 997c4b56ed
Merge pull request #3961 from mheon/copy_volume_contents
When first mounting any named volume, copy up
2019-09-10 22:24:43 +02:00
Matthew Heon c2284962c7 Add support for launching containers without CGroups
This is mostly used with Systemd, which really wants to manage
CGroups itself when managing containers via unit file.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-10 10:52:37 -04:00
Sascha Grunert df036f9f8e
Add ContainerManager annotation to created containers
This change adds the following annotation to every container created by
podman:

```json
"Annotations": {
    "io.containers.manager": "libpod"
}
```

Target of this annotaions is to indicate which project in the containers
ecosystem is the major manager of a container when applications share
the same storage paths. This way projects can decide if they want to
manipulate the container or not. For example, since CRI-O and podman are
not using the same container library (libpod), CRI-O can skip podman
containers and provide the end user more useful information.

A corresponding end-to-end test has been adapted as well.

Relates to: https://github.com/cri-o/cri-o/pull/2761

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
2019-09-10 09:37:14 +02:00
Matthew Heon b6106341fb When first mounting any named volume, copy up
Previously, we only did this for volumes created at the same time
as the container. However, this is not correct behavior - Docker
does so for all named volumes, even those made with
'podman volume create' and mounted into a container later.

Fixes #3945

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-09 17:17:39 -04:00
OpenShift Merge Robot 9a55bce9e4
Merge pull request #3896 from mheon/volume_lookup
Add ability to look up volumes by unambiguous partial name
2019-09-09 21:48:30 +02:00
Matthew Heon 046178e55f Add function for looking up volumes by partial name
This isn't included in Docker, but seems handy enough.

Use the new API for 'volume rm' and 'volume inspect'.

Fixes #3891

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-09 12:06:10 -04:00
baude ee432cf279 podman network create
initial implementation of network create.  we only support bridging
networks with this first pass.

Signed-off-by: baude <bbaude@redhat.com>
2019-09-09 09:32:43 -05:00
OpenShift Merge Robot 88980859ec
Merge pull request #3958 from haircommander/play-kube-sec
play kube: fix segfault
2019-09-06 15:40:13 +02:00
Peter Hunt 9259693826 play kube: fix segfault
when securityContext wasn't specified in yaml.
add a test as well

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2019-09-06 08:41:04 -04:00
Matthew Heon a760e325f3 Add ability for volumes with options to mount/umount
When volume options and the local volume driver are specified,
the volume is intended to be mounted using the 'mount' command.
Supported options will be used to volume the volume before the
first container using it starts, and unmount the volume after the
last container using it dies.

This should work for any local filesystem, though at present I've
only tested with tmpfs and btrfs.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-05 17:12:27 -04:00
OpenShift Merge Robot b962b1e353
Merge pull request #3943 from gabibeyer/fix_tests
Fix unit tests missing comparative for 'Expect'
2019-09-05 12:49:21 +02:00
gabi beyer 95f5411e88 Fix unit tests missing comparative for 'Expect'
Add '.To(BeTrue())' to 'Expect(' statements in unit tests that
are missing them. These tests weren't being compared to anything,
thus reporting false positives.

Signed-off-by: gabi beyer <gabrielle.n.beyer@intel.com>
2019-09-04 23:30:24 +00:00
OpenShift Merge Robot ab44484bec
Merge pull request #3876 from mheon/fix_mount_flags
Allow suid, exec, dev mount options to cancel nosuid/noexec/nodev
2019-09-04 22:43:41 +02:00
Matthew Heon 5f15501578 Add test to verify noexec works with volume mounts
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-09-04 13:19:19 -04:00
Giuseppe Scrivano ba1c57030f
rootless: bind mount devices instead of creating them
when running in rootless mode, --device creates a bind mount from the
host instead of specifying the device in the OCI configuration.  This
is required as an unprivileged user cannot use mknod, even when root
in a user namespace.

Closes: https://github.com/containers/libpod/issues/3905

Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
2019-09-02 13:03:19 +02:00
Matthew Heon c13a52cfde Add a test for the new suid/exec/dev options
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2019-08-28 14:28:52 -04:00