diff options
author | umohnani8 <umohnani@redhat.com> | 2018-06-26 09:59:26 -0400 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-06-27 09:46:50 +0000 |
commit | c75f4d4e70bb93e98d0573b6b01b80971b9f880d (patch) | |
tree | ae6702a7c4653e4ba06c799f7e8af9f40b6632dc | |
parent | 143ea6e66e1d77806baffcc6228a6e64ef655fd1 (diff) | |
download | podman-c75f4d4e70bb93e98d0573b6b01b80971b9f880d.tar.gz podman-c75f4d4e70bb93e98d0573b6b01b80971b9f880d.tar.bz2 podman-c75f4d4e70bb93e98d0573b6b01b80971b9f880d.zip |
Add --authfile to podman search
Since podman search requires credentials to search private registries,
add the --authfile flag to allow users to pass in credentials from a
different authfile than the default one.
Signed-off-by: umohnani8 <umohnani@redhat.com>
Closes: #998
Approved by: rhatdan
-rw-r--r-- | cmd/podman/search.go | 24 | ||||
-rw-r--r-- | completions/bash/podman | 1 | ||||
-rw-r--r-- | docs/podman-search.1.md | 4 |
3 files changed, 20 insertions, 9 deletions
diff --git a/cmd/podman/search.go b/cmd/podman/search.go index 96a17fb64..064badec8 100644 --- a/cmd/podman/search.go +++ b/cmd/podman/search.go @@ -23,6 +23,10 @@ const ( var ( searchFlags = []cli.Flag{ + cli.StringFlag{ + Name: "authfile", + Usage: "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json", + }, cli.StringSliceFlag{ Name: "filter, f", Usage: "filter output based on conditions provided (default [])", @@ -71,10 +75,11 @@ type searchParams struct { } type searchOpts struct { - filter []string - limit int - noTrunc bool - format string + filter []string + limit int + noTrunc bool + format string + authfile string } type searchFilterParams struct { @@ -105,10 +110,11 @@ func searchCmd(c *cli.Context) error { format := genSearchFormat(c.String("format")) opts := searchOpts{ - format: format, - noTrunc: c.Bool("no-trunc"), - limit: c.Int("limit"), - filter: c.StringSlice("filter"), + format: format, + noTrunc: c.Bool("no-trunc"), + limit: c.Int("limit"), + filter: c.StringSlice("filter"), + authfile: c.String("authfile"), } regAndSkipTLS, err := getRegistriesAndSkipTLS(c) if err != nil { @@ -206,7 +212,7 @@ func getSearchOutput(term string, regAndSkipTLS map[string]bool, opts searchOpts limit = opts.limit } - sc := common.GetSystemContext("", "", false) + sc := common.GetSystemContext("", opts.authfile, false) var paramsArr []searchParams for reg, skipTLS := range regAndSkipTLS { // set the SkipTLSVerify bool depending on the registry being searched through diff --git a/completions/bash/podman b/completions/bash/podman index d4679c570..69588ae27 100644 --- a/completions/bash/podman +++ b/completions/bash/podman @@ -1299,6 +1299,7 @@ _podman_pull() { _podman_search() { local options_with_args=" + --authfile --filter -f --format --limit diff --git a/docs/podman-search.1.md b/docs/podman-search.1.md index 858d82ae3..e276f67b7 100644 --- a/docs/podman-search.1.md +++ b/docs/podman-search.1.md @@ -29,6 +29,10 @@ using the **--filter** flag. ## OPTIONS +**--authfile** + +Path of the authentication file. Default is ${XDG_\RUNTIME\_DIR}/containers/auth.json + **--filter, -f** Filter output based on conditions provided (default []) |