Commit graph

32 commits

Author SHA1 Message Date
Valentin Rothberg bd09b7aa79 bump go module to version 4
Automated for .go files via gomove [1]:
`gomove github.com/containers/podman/v3 github.com/containers/podman/v4`

Remaining files via vgrep [2]:
`vgrep github.com/containers/podman/v3`

[1] https://github.com/KSubedi/gomove
[2] https://github.com/vrothberg/vgrep

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2022-01-18 12:47:07 +01:00
OpenShift Merge Robot 9212c74ff1
Merge pull request #12600 from rhatdan/external
Show --external containers even without --all option
2021-12-15 15:43:11 +01:00
Daniel J Walsh 51a4bef2e6
Show --external containers even without --all option
We currently do not show --external containers when the user specifies
it, unless they also specify the --all flag. This has led to confusion.
I see no reason not to list them without the --all flag if the user
specifies the option.

Fixes: https://github.com/containers/podman/issues/12353

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-12-14 16:03:21 -05:00
Paul Holzinger 4e8ad039ce
remove unneeded return value from c.Networks()
We do not need to return a extra bool.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
2021-12-14 15:23:38 +01:00
Matthew Heon 8bd9f58d1d Ensure podman ps --sync functions
The backend for `ps --sync` has been nonfunctional for a long
while now - probably since v2.0. It's questionable how useful the
flag is in modern Podman (the original case it was intended to
catch, Conmon gone via SIGKILL, should be handled now via pinging
the process with a signal to ensure it's still alive) but having
the ability to force a refresh of container state from the OCI
runtime is still useful.

Signed-off-by: Matthew Heon <mheon@redhat.com>
2021-10-06 11:19:32 -04:00
Jhon Honce c67593df12 [NO TESTS NEEDED] Ignore removed containers
* Ignore condition when containers are removed while listing them for
ps output.

  No tests added at this time as they would create a race condition for
CI.

* Updated godocs

See https://github.com/containers/podman/issues/11810 for reproducer.

Fixes #11810

Signed-off-by: Jhon Honce <jhonce@redhat.com>
2021-10-01 11:17:15 -07:00
Sankalp Rangare 1e0039a839 added healthcheck to ps command
Signed-off-by: Sankalp Rangare <sankalprangare786@gmail.com>
2021-09-24 20:24:23 +05:30
Daniel J Walsh 1c4e6d8624
standardize logrus messages to upper case
Remove ERROR: Error stutter from logrus messages also.

[ NO TESTS NEEDED] This is just code cleanup.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-09-22 15:29:34 -04:00
Valentin Rothberg e1ac0c3033 vendor containers/common@main
The `IgnorePlatform` options has been removed from the
`LookupImageOptions` in libimage to properly support multi-arch images.

Skip one buildah-bud test which requires updated CI images.  This is
currently being done in github.com/containers/podman/pull/10829 but
we need to unblock merging common and buildah into podman.

[NO TESTS NEEDED]

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-07-16 14:19:56 +02:00
flouthoc 2243b60203 reset: remove external containers on podman system reset
[NO TESTS NEEDED]

Signed-off-by: flouthoc <flouthoc.git@gmail.com>
2021-06-30 09:04:08 +05:30
Valentin Rothberg 0f7d54b026 migrate Podman to containers/common/libimage
Migrate the Podman code base over to `common/libimage` which replaces
`libpod/image` and a lot of glue code entirely.

Note that I tried to leave bread crumbs for changed tests.

Miscellaneous changes:

 * Some errors yield different messages which required to alter some
   tests.

 * I fixed some pre-existing issues in the code.  Others were marked as
   `//TODO`s to prevent the PR from exploding.

 * The `NamesHistory` of an image is returned as is from the storage.
   Previously, we did some filtering which I think is undesirable.
   Instead we should return the data as stored in the storage.

 * Touched handlers use the ABI interfaces where possible.

 * Local image resolution: previously Podman would match "foo" on
   "myfoo".  This behaviour has been changed and Podman will now
   only match on repository boundaries such that "foo" would match
   "my/foo" but not "myfoo".  I consider the old behaviour to be a
   bug, at the very least an exotic corner case.

 * Futhermore, "foo:none" does *not* resolve to a local image "foo"
   without tag anymore.  It's a hill I am (almost) willing to die on.

 * `image prune` prints the IDs of pruned images.  Previously, in some
   cases, the names were printed instead.  The API clearly states ID,
   so we should stick to it.

 * Compat endpoint image removal with _force_ deletes the entire not
   only the specified tag.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-05-05 11:30:12 +02:00
Valentin Rothberg 5dded6fae7 bump go module to v3
We missed bumping the go module, so let's do it now :)

* Automated go code with github.com/sirkon/go-imports-rename
* Manually via `vgrep podman/v2` the rest

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2021-02-22 09:03:51 +01:00
Daniel J Walsh 21cb3043fc
podman-remote ps --external --pod --sort do not work.
Fixup the bindings and the handling of the --external --por and --sort
flags.

The --storage option was renamed --external, make sure we use
external up and down the stack.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2021-01-27 06:44:43 -05:00
Paul Holzinger 38baf3d5e2 Add Networks format placeholder to podman ps and pod ps
`podman ps --format {{.Networks}}` will show all connected networks for
this container. For `pod ps` it will show the infra container networks.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2021-01-09 19:15:43 +01:00
Baron Lenardson 76afb50f3a Consolidate filter logic to pkg subdirectory
Per the conversation on pull/8724 I am consolidating filter logic
and helper functions under the pkg/domain/filters dir.

Signed-off-by: Baron Lenardson <lenardson.baron@gmail.com>
2020-12-24 20:27:41 +00:00
Daniel J Walsh 098e0a7885
Handle --rm when starting a container
podman start should follow the same behaviour as podman run when removing a
container.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-12-11 06:07:14 -05:00
Daniel J Walsh 2d861ac14a
Handle ps container created field as a time.Time
In the current code we were translating the created time
from a time.Time to a unix epoch, this was leading to a loss
of precession, and some unexpected results where the sorting
order of containers was misordered because of the precession loss.

If we pass around created as time.Time, we do not loose the precission.

Fixes: https://github.com/containers/podman/issues/8414

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-11-20 10:50:30 -05:00
Paul Holzinger 4f427a89cb Align the podman ps --filter behavior with docker
All of our filters worked exclusive resulting in `--filter status=created --filter status=exited` to return nothing.

In docker filters with the same key work inclusive with the only exception being `label` which is exclusive. Filters with different keys always work exclusive.

This PR aims to match the docker behavior with podman.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
2020-11-18 11:36:06 +01:00
zhangguanzhang 4a2c4c3989 Fix podman-remote ps --ns broken
Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
2020-10-04 19:48:13 +08:00
Daniel J Walsh 581afbb86f
Show c/storage (Buildah/CRI-O) containers in ps
The `podman ps --all` command will now show containers that
are under the control of other c/storage container systems and
the new `ps --storage` option will show only containers that are
in c/storage but are not controlled by libpod.

In the below examples, the '*working-container' entries were created
by Buildah.

```
podman ps -a
CONTAINER ID  IMAGE                             COMMAND  CREATED       STATUS                   PORTS  NAMES
9257ef8c786c  docker.io/library/busybox:latest  ls /etc  8 hours ago   Exited (0) 8 hours ago          gifted_jang
d302c81856da  docker.io/library/busybox:latest  buildah  30 hours ago  storage                         busybox-working-container
7a5a7b099d33  localhost/tom:latest              ls -alF  30 hours ago  Exited (0) 30 hours ago         hopeful_hellman
01d601fca090  localhost/tom:latest              ls -alf  30 hours ago  Exited (1) 30 hours ago         determined_panini
ee58f429ff26  localhost/tom:latest              buildah  33 hours ago  storage                         alpine-working-container

podman ps --external
CONTAINER ID  IMAGE                             COMMAND  CREATED       STATUS    PORTS  NAMES
d302c81856da  docker.io/library/busybox:latest  buildah  30 hours ago  external         busybox-working-container
ee58f429ff26  localhost/tom:latest              buildah  33 hours ago  external         alpine-working-container

```
Signed-off-by: TomSweeneyRedHat <tsweeney@redhat.com>
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-09-09 06:10:02 -04:00
Matthew Heon 569854d634 Unconditionally retrieve pod names via API
The ListContainers API previously had a Pod parameter, which
determined if pod name was returned (but, notably, not Pod ID,
which was returned unconditionally). This was fairly confusing,
so we decided to deprecate/remove the parameter and return it
unconditionally.

To do this without serious performance implications, we need to
avoid expensive JSON decodes of pod configuration in the DB. The
way our Bolt tables are structured, retrieving name given ID is
actually quite cheap, but we did not expose this via the Libpod
API. Add a new GetName API to do this.

Fixes #7214

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-08-10 10:15:51 -04:00
Daniel J Walsh a5e37ad280
Switch all references to github.com/containers/libpod -> podman
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-07-28 08:23:45 -04:00
Valentin Rothberg 8489dc4345 move go module to v2
With the advent of Podman 2.0.0 we crossed the magical barrier of go
modules.  While we were able to continue importing all packages inside
of the project, the project could not be vendored anymore from the
outside.

Move the go module to new major version and change all imports to
`github.com/containers/libpod/v2`.  The renaming of the imports
was done via `gomove` [1].

[1] https://github.com/KSubedi/gomove

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-07-06 15:50:12 +02:00
Matthew Heon 16b3356a89 Print port mappings in ps for ctrs sharing network
In Podman v1.9, we printed port mappings for the container, even
if it shared its network namespace (and thus ports) with another
container. We regressed on this in Podman v2.0, which is fixed
here.

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
2020-06-24 17:27:26 -04:00
Daniel J Walsh 200cfa41a4
Turn on More linters
- misspell
    - prealloc
    - unparam
    - nakedret

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-06-15 07:05:56 -04:00
Valentin Rothberg d6469c9c9b fix ps --last=N
Fix `ps --last=N` to also include non-running containers. Also add an
e2e test to prevent us from regressing in the future.

Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
2020-05-28 14:24:01 +02:00
Daniel J Walsh a83d1a2772
Make podman container list == podman ps
Also make
podman create -p PUBLISHPorts
work.

This PR fixes ps_test.go

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2020-04-27 09:51:26 -04:00
Brent Baude ba430bfe5e podman v2 remove bloat v2
rid ourseleves of libpod references in v2 client

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-16 12:04:46 -05:00
Brent Baude 30d2964ff8 v2 bloat pruning phase 2
this is second phase of removing unneeded bloat in the remote client. this is important to be able to reduce the client size as well as possible native compilation for windows/mac.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-15 16:09:27 -05:00
Brent Baude 830f3a4462 v2podman ps revert structure changes
reverting name changes to the listcontainer structure because it negatively impacted the direct consumption of the restful API.  instead we now use a local structure in the CLI to modify the output as needed.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-14 09:40:43 -05:00
Brent Baude 8ce23775a6 v2podman ps alter formats
in order to get the go templating to work for custom input, we now use structure methods instead of template map funcs.  this requires some manipulation of fields so that the funcs can have the proper names.

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-08 09:11:26 -05:00
Brent Baude b22254dc8b podmanv2 ps
add the ability to list containers

Signed-off-by: Brent Baude <bbaude@redhat.com>
2020-04-06 12:12:59 -05:00