Commit Graph

12 Commits

Author SHA1 Message Date
Qi Wang d7c0f968ca fix bug check nonexist authfile
Use GetDefaultAuthFile() from buildah.
For podman command(except login), if authfile does not exist returns error.

close #4328

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-11-05 21:32:18 -05:00
Hunor Csomortáni f4c7a66149 Fix default path for auth.json
Default path should be ${XDG_RUNTIME_DIR}/containers/auth.json according
to the docs.

This regressed to ${XDG_RUNTIME_DIR}/auth.json in #3760.

Fixes: #4227

Signed-off-by: Hunor Csomortáni <csomh@redhat.com>
2019-10-10 21:51:25 +02:00
Daniel J Walsh d27e71374e
Use GetRuntimeDir to setup auth.json for login
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
2019-08-12 14:11:53 -04:00
Giuseppe Scrivano 714d36b088
podman: create and run honors auth file location
if the auth file was overriden, be sure create and run honors it.

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

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2019-07-09 14:21:15 +02:00
Qi Wang a477a8ff75 Add variable for global flags to runlabel
use $GLOBAL_OPTS to pass global flags to the runlabel command.

Signed-off-by: Qi Wang <qiwan@redhat.com>
2019-05-02 12:14:51 -04:00
baude 10a62d60a9 container runlabel NAME implementation
when using container runlabel, if a --name is not provided, we must
deduce the container name from the base name of the image to maintain
parity with the atomic cli.

fixed small bug where we split the cmd on " " rather than using fields could
lead to extra spaces in command output.

Signed-off-by: baude <bbaude@redhat.com>
2019-01-04 12:57:55 -06:00
baude 0c3501acb5 runlabel should sub podman for docker|/usr/bin/docker
Many RH images use a fully-qualified path to docker in their RUN
labels.  While initially we wanted an exact match for substituting
commands, docker is a good exception.

Bug #1623282

Signed-off-by: baude <bbaude@redhat.com>
2018-12-13 10:23:22 -06:00
Valentin Rothberg 780b790415 runlabel: use shlex for splitting commands
Use github.com/google/shlex for splitting commands instead of splitting
at whitespaces.  This way, we avoid accidentally splitting single string
arguments into mutliple ones.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
2018-11-16 16:05:07 +01:00
Valentin Rothberg 606a5cec8f runlabel: run any command
As discussed [1], the runlabel command should execute any command
specified in a label.  The reasoning behind is that we cannot restrict
which options are passed to Podman which thereby has full access to the
host (runlabels must be used with care).

With the updated semantics, runlabel will substitute the commands with a
basepath equal to "docker" or "podman" with "/proc/self/exe", and
otherwise leave the command unchanged to execute any other command on
the host.

[1] https://github.com/containers/libpod/pull/1607#issuecomment-428321382

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
2018-10-24 14:02:43 +02:00
baude 255b56ae41 fix runlabel functions based on QA feedback
Signed-off-by: baude <bbaude@redhat.com>
2018-10-11 09:52:53 -05:00
Valentin Rothberg d4eca12cc1 runlabel: execute /proc/self/exe and avoid recursion
Execute /proc/self/exe instead of podman.  This makes the runlabel
command more portable as it works for binaries outside the path as
well as for local builds.

Also, avoid redundantly executing the runlabel command by setting
the PODMAN_RUNLABEL_NESTED environment variable to "1".  Podman
now checks for this variable before executing the runlabel command
and will throw an error in case the variable is set.

Signed-off-by: Valentin Rothberg <vrothberg@suse.com>
2018-10-05 17:28:18 +02:00
baude 4f825f2e07 Add container runlabel command
Execute the command as described by a container image.  The value of the label is processed
into a command by:

1. Ensuring the first argument of the command is podman.
2. Substituting any variables with those defined by the environment or otherwise.

If no label exists in the container image, nothing is done.

podman container runlabel LABEL IMAGE extra_args
Signed-off-by: baude <bbaude@redhat.com>
2018-09-28 14:14:13 -05:00