Commit Graph

16 Commits

Author SHA1 Message Date
Giuseppe Scrivano e8d7b9e061
drivers: Allow map-specific ID shifting decisions
The `SupportsShifting` method signature has been updated
to include `uidmap` and `gidmap` parameters.

Previously, a driver could only declare general support
for shifting.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2025-06-09 09:01:51 +02:00
Jan Rodák fc0e509e05
Fix deprecated use of pwalk.Walk (SA1019)
Signed-off-by: Jan Rodák <hony.com@seznam.cz>
2024-06-19 16:04:40 +02:00
Miloslav Trmač 5e8eb4c69a Check and report errors in driver.Put()
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
2022-10-01 02:46:53 +02:00
Nalin Dahyabhai 62e10d108f Don't use subprocess output as a format specifier
Don't pass the output of a subprocess to fmt.Errorf(), which will treat
it as a format specifier.  Just use errors.New() to create an error
using the text verbatim.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2022-08-31 10:44:32 -04:00
Daniel J Walsh 3f8c0dc0de
Wrap errors properly with fmt.Errorf
Also returned errors should not begine with a capatalized errors.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2022-07-12 13:26:10 -04:00
Giuseppe Scrivano e085aa8d0b
drivers, chown: move platformLChown to a struct
it is a preparatory commit.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2022-02-21 15:23:22 +01:00
Nalin Dahyabhai 5ef1e9d68b Use json-iterator instead of encoding/json
Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2021-05-06 12:24:24 -04:00
Kir Kolyshkin e517250392 drivers/chown: use pwalk.Walk
This is a parallel Walk implementation and we're expecting some
speedup thanks to that.

Note that pwalk.Walk error handling is primitive; for one thing,
it never sends an error to the callpack, thus the error checking
code is no longer needed.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-11 08:36:34 -07:00
Giuseppe Scrivano 5995d88179
chown: do not change owner for the mountpoint
This is already done by the driver when creating the directory, so we
will end up trying to map IDs that were already mapped.

regression introduced with d1554f0dcd
and 7c6d502e9b.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-05-15 17:02:31 +02:00
Daniel J Walsh b6ccc0acfa
Add MountOpts to stop adding fields to Get Interface
This patch adds a MountOpts field to the drivers so we can simplify
the interface to Get and allow additional options to be passed in the future.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2018-10-05 09:23:46 -04:00
Giuseppe Scrivano 1897396330
drivers: inform Mount of the mappings used by the container
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-26 06:12:42 +02:00
Giuseppe Scrivano 9bb1031ef0
drivers: add new method SupportsShifting() to LayerIDMapUpdater
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2018-07-26 06:12:39 +02:00
Vincent Batts 019f3a4038
drivers: cross-platform chown
and a tidy-up of imports

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
2018-05-30 17:05:51 -04:00
Nalin Dahyabhai 39e94a2b32 Use stderr for error messages in ChownByPath
Use stderr for outputting error messages in ChownByPath's reexec'd
main(), and use CombinedOutput() instead of Output() to pick up that
output.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Nalin Dahyabhai 97326e1d2f Support for per-container uid/gid mapping: lower
Expose reading and writing ID mapping in the archive and chrootarchive
packages, and in the driver interface.  Generally this means that
when computing or applying diffs, we need to have ID mappings passed in
that are specific to the layers we're using.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00
Nalin Dahyabhai b71d4c4197 Support for per-container uid/gid mapping: upper
Add support to the Store objects for per-container UID/GID mapping.
* UID and GID maps can be specified when creating layers and containers.
* If mapping options are specified when creating a container, those
  options are used for creating the layer which we create for the
  container and recorded with the container for convenience.
* A layer defaults to using the ID mapping configured for its parent, or
  to the default which was used to initialize the Store object if it has
  no parent.

Signed-off-by: Nalin Dahyabhai <nalin@redhat.com>
2018-04-03 10:34:32 -04:00