summaryrefslogtreecommitdiff
path: root/cmd/podman/system/connection.go
blob: 3af905fad1cd8c58a2890fe085f112535ced806c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// +build !remote

package system

import (
	"github.com/containers/libpod/cmd/podman/registry"
	"github.com/containers/libpod/pkg/domain/entities"
	"github.com/spf13/cobra"
)

var (
	connectionDescription = `TBD
`
	connectionCommand = &cobra.Command{
		Use: "connection",
		//Args:    validate.NoArgs,
		Long:  connectionDescription,
		Short: "Add remote ssh connection",
		RunE:  connection,
		Example: `podman system connection server.foobar.com
podman system connection --identity ~/.ssh/dev_rsa --default root@server.foobar.com:222`,
	}
)

var connectionOptions = struct {
	Alias      string
	Default    bool
	Identity   string
	SocketPath string
	User       string
}{}

func init() {
	registry.Commands = append(registry.Commands, registry.CliCommand{
		Mode:    []entities.EngineMode{entities.ABIMode},
		Command: connectionCommand,
		Parent:  systemCmd,
	})
	flags := connectionCommand.Flags()
	flags.StringVar(&connectionOptions.Alias, "alias", "", "alias name for connection")
	flags.BoolVar(&connectionOptions.Default, "default", false, "set as the default connection")
	flags.StringVar(&connectionOptions.Identity, "identity", "", "path to ssh identity file")
	//flags.StringVar(&connectionOptions.User, "user", "", "remote username")
	flags.StringVar(&connectionOptions.SocketPath, "socket-path", "", "path to podman socket on remote host")
}

func connection(cmd *cobra.Command, args []string) error {
	// if no user is provided, assume local user name
	// if no socket is provided, then do an ssh to look for it
	// default connection, if exists, is then assumed with podman remote
	// if no identity exists, should we be prompting for password?

	return nil
}