summaryrefslogtreecommitdiff
path: root/cmd/kpod/logout.go
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2017-12-15 16:58:36 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2017-12-18 16:46:05 +0000
commit5770dc2640c216525ab84031e3712fcc46b3b087 (patch)
tree8a1c5c4e4a6ce6a35a3767247623a62bfd698f77 /cmd/kpod/logout.go
parentde3468e120d489d046c08dad72ba2262e222ccb1 (diff)
downloadpodman-5770dc2640c216525ab84031e3712fcc46b3b087.tar.gz
podman-5770dc2640c216525ab84031e3712fcc46b3b087.tar.bz2
podman-5770dc2640c216525ab84031e3712fcc46b3b087.zip
Rename all references to kpod to podman
The decision is in, kpod is going to be named podman. Signed-off-by: Daniel J Walsh <dwalsh@redhat.com> Closes: #145 Approved by: umohnani8
Diffstat (limited to 'cmd/kpod/logout.go')
-rw-r--r--cmd/kpod/logout.go69
1 files changed, 0 insertions, 69 deletions
diff --git a/cmd/kpod/logout.go b/cmd/kpod/logout.go
deleted file mode 100644
index cae8ddfb2..000000000
--- a/cmd/kpod/logout.go
+++ /dev/null
@@ -1,69 +0,0 @@
-package main
-
-import (
- "fmt"
-
- "github.com/containers/image/pkg/docker/config"
- "github.com/pkg/errors"
- "github.com/projectatomic/libpod/libpod/common"
- "github.com/urfave/cli"
-)
-
-var (
- logoutFlags = []cli.Flag{
- cli.StringFlag{
- Name: "authfile",
- Usage: "Path of the authentication file. Default is ${XDG_RUNTIME_DIR}/containers/auth.json",
- },
- cli.BoolFlag{
- Name: "all, a",
- Usage: "Remove the cached credentials for all registries in the auth file",
- },
- }
- logoutDescription = "Remove the cached username and password for the registry."
- logoutCommand = cli.Command{
- Name: "logout",
- Usage: "logout of a container registry",
- Description: logoutDescription,
- Flags: logoutFlags,
- Action: logoutCmd,
- ArgsUsage: "REGISTRY",
- }
-)
-
-// logoutCmd uses the authentication package to remove the authenticated of a registry
-// stored in the auth.json file
-func logoutCmd(c *cli.Context) error {
- args := c.Args()
- if len(args) > 1 {
- return errors.Errorf("too many arguments, logout takes only 1 argument")
- }
- if len(args) == 0 {
- return errors.Errorf("registry must be given")
- }
- var server string
- if len(args) == 1 {
- server = args[0]
- }
-
- sc := common.GetSystemContext("", c.String("authfile"), false)
-
- if c.Bool("all") {
- if err := config.RemoveAllAuthentication(sc); err != nil {
- return err
- }
- fmt.Println("Remove login credentials for all registries")
- return nil
- }
-
- err := config.RemoveAuthentication(sc, server)
- switch err {
- case nil:
- fmt.Printf("Remove login credentials for %s\n", server)
- return nil
- case config.ErrNotLoggedIn:
- return errors.Errorf("Not logged into %s\n", server)
- default:
- return errors.Wrapf(err, "error logging out of %q", server)
- }
-}