Commit Graph

14 Commits

Author SHA1 Message Date
Nalin Dahyabhai 87b926f5f2 test helper: maxArgs = 0 is actually a meaningful value
We do have commands that don't take any arguments, and quietly ignoring
arguments when they get them is not a good idea.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2023-01-27 09:21:43 -05:00
Miloslav Trmač d60159bc30 Add more error handling to cmd/containers-storage
Introduce an outputJSON helper to decrease repetition.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-14 17:17:54 +02:00
Miloslav Trmač ace9c41df3 Consolidate error reporting in cmd/containers-storage
Have the action handlers return an error value, and let
main() format that error, if any; this avoids duplicated
error formating code in the action handlers, dropping
89 lines.

This might change the error format in some cases (typically
%v vs. %+v).

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-14 17:17:53 +02:00
Miloslav Trmač b0c2fe5f20 Add missing error handling
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-09-12 16:31:41 +02:00
Miloslav Trmač 7635db182b Use io.ReadAll instead of ioutil.ReadAll
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-09-12 16:30:46 +02:00
Giuseppe Scrivano cf998256f7
store: don't ignore empty mappings for top layer
do not pick the first available image if it was requested to not use
any mapping.

It causes a problem where an image is already present in the local
store with a mapping, then a container that doesn't specify any
mapping would end up to reuse that:

$ podman system reset -y
$ podman run --rm --uidmap 0:10000:1000 centos ls -ld /home
drwxr-xr-x. 2 root root 6 Nov  3  2020 /home

$ podman run --rm centos ls -ld /home
drwxr-xr-x. 2 10000 10000 6 Nov  3  2020 /home

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-09-10 17:43:02 +02:00
Daniel J Walsh ef42340c2e
Revert "Add MountTempFromSource and RemoveTemp interfaces"
This reverts commit e9695564db.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-05-02 11:54:55 -04:00
Daniel J Walsh e9695564db
Add MountTempFromSource and RemoveTemp interfaces
These interfaces can be used to setup a graphdriver mountpoint
of the source directory for use within a container.
The RemoveTemp interface umounts the mountpoint and then removes
all of the modified data in the graphdriver for this source directory.

The primary use case of these interfaces is for container engines that
want to mount a directory from the host system into the container. The
source dirctory then can be modified without actually changing the
directory on the host.

Containers will use these interfaces for sharing packaing cache directories
like /var/cache/dnf, to help speed up container builds.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-04-29 14:46:40 -04:00
Nalin Dahyabhai 06025caa49 CLI helper: print backtraces with errors
Print backtrace information when displaying an error returned by our
API, to make troubleshooting tests a bit easier.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2019-02-26 14:19:15 -05:00
Nalin Dahyabhai c16e8ec318 Add Store.ContainerSize()
Add a ContainerSize() method, which knows how to compute the sizes of
container, so that our callers don't need to all be updated when we make
changes to how we store them.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-05-30 17:16:53 -04:00
Nalin Dahyabhai 13ae73afef CLI: fix JSON output for layer/container-parent-owners
Provide the information that was actually requested when we produce JSON
output for the layer-parent-owners and container-parent-owners commands.
Carried over from #156.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-10 14:39:47 -04:00
Nalin Dahyabhai aefafeeb85 Add LayerParentOwners()/ContainerParentOwners()
Add store methods for finding the list of UIDs and GIDs which probably
need to be mapped if a given layer or container's layer, which has to
have been mounted at least once in order for us to know where it goes,
is going to be used for a container that is run with the configured ID
mappings in a separate user namespace.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Nalin Dahyabhai 240fe6016c Wrap new data retrieval APIs in the CLI tool
Add CLI wrappers for the store's
  ImageBigDataDigest
  ImageBigDataSize
  ContainerBigDataDigest
  ContainerBigDataSize
methods.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-10-02 17:50:01 -04:00
Nalin Dahyabhai 77ad6176a9 Rename CLI from oci-storage to containers-storage
Rename the CLI tool to match the name that we gave the transport that
uses it in containers/image, which affects just about every consumer of
this library.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2017-05-25 15:50:33 -04:00