Commit Graph

15 Commits

Author SHA1 Message Date
Kir Kolyshkin fa414d963d Format sources with gofumpt
gofumpt is a superset of gofmt, enabling some more code formatting
rules.

This commit is brought to you by

	gofumpt -w .

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2023-05-26 16:17:31 -07:00
Nalin Dahyabhai 4d61c789f3 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č 67e2c873d4 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č 7c002b2a2a 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č e52f3a3174 Add missing error handling
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-09-12 16:31:41 +02:00
Miloslav Trmač 9fd7784912 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 baadf0826d 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 6b873f8a28 Revert "Add MountTempFromSource and RemoveTemp interfaces"
This reverts commit fc8f95f179.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-05-02 11:54:55 -04:00
Daniel J Walsh fc8f95f179 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 6275d3a46a 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 92105b61a8 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 afc53ace61 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 33d36cbee8 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 3bb057c467 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 d96905a24e 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