Skip to content
This repository was archived by the owner on Dec 17, 2021. It is now read-only.

Commit 26e2641

Browse files
committed
cmd/machine: Adapt for lambda-machine-local
* cmd/machine.go - Remove unsupported drivers - Remove `tls-*` options - Use `../lambda-machine-local/...` packages - Rename to `lambda-machine-local` * cmd/machine_test.go - Use `../lambda-machine-local/commands/mcndirs` Tests in this file does not pass. This behavior is similar to `docker-machine`.
1 parent bedc6c8 commit 26e2641

File tree

2 files changed

+11
-77
lines changed

2 files changed

+11
-77
lines changed

cmd/machine.go

Lines changed: 9 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,13 @@ import (
88
"path/filepath"
99

1010
"github.com/codegangsta/cli"
11-
"github.com/docker/machine/commands"
12-
"github.com/docker/machine/commands/mcndirs"
13-
"github.com/docker/machine/drivers/amazonec2"
14-
"github.com/docker/machine/drivers/azure"
15-
"github.com/docker/machine/drivers/digitalocean"
16-
"github.com/docker/machine/drivers/exoscale"
17-
"github.com/docker/machine/drivers/generic"
18-
"github.com/docker/machine/drivers/google"
19-
"github.com/docker/machine/drivers/hyperv"
20-
"github.com/docker/machine/drivers/none"
21-
"github.com/docker/machine/drivers/openstack"
22-
"github.com/docker/machine/drivers/rackspace"
23-
"github.com/docker/machine/drivers/softlayer"
24-
"github.com/docker/machine/drivers/virtualbox"
25-
"github.com/docker/machine/drivers/vmwarefusion"
26-
"github.com/docker/machine/drivers/vmwarevcloudair"
27-
"github.com/docker/machine/drivers/vmwarevsphere"
2811
"github.com/docker/machine/libmachine/drivers/plugin"
2912
"github.com/docker/machine/libmachine/drivers/plugin/localbinary"
3013
"github.com/docker/machine/libmachine/log"
31-
"github.com/docker/machine/version"
14+
"github.com/lambda-linux/lambda-machine-local/commands"
15+
"github.com/lambda-linux/lambda-machine-local/commands/mcndirs"
16+
"github.com/lambda-linux/lambda-machine-local/drivers/virtualbox"
17+
"github.com/lambda-linux/lambda-machine-local/version"
3218
)
3319

3420
var AppHelpTemplate = `Usage: {{.Name}} {{if .Flags}}[OPTIONS] {{end}}COMMAND [arg...]
@@ -50,7 +36,7 @@ Commands:
5036
Run '{{.Name}} COMMAND --help' for more information on a command.
5137
`
5238

53-
var CommandHelpTemplate = `Usage: docker-machine {{.Name}}{{if .Flags}} [OPTIONS]{{end}} [arg...]
39+
var CommandHelpTemplate = `Usage: lambda-machine-local {{.Name}}{{if .Flags}} [OPTIONS]{{end}} [arg...]
5440
5541
{{.Usage}}{{if .Description}}
5642
@@ -96,15 +82,15 @@ func main() {
9682
cli.CommandHelpTemplate = CommandHelpTemplate
9783
app := cli.NewApp()
9884
app.Name = filepath.Base(os.Args[0])
99-
app.Author = "Docker Machine Contributors"
100-
app.Email = "https://github.com/docker/machine"
85+
app.Author = "Lambda Machine Local Contributors"
86+
app.Email = "https://github.com/lambda-linux/lambda-machine-local"
10187

10288
app.Commands = commands.Commands
10389
app.CommandNotFound = cmdNotFound
104-
app.Usage = "Create and manage machines running Docker."
90+
app.Usage = "Create and manage local machines running Docker."
10591
app.Version = version.FullVersion()
10692

107-
log.Debug("Docker Machine Version: ", app.Version)
93+
log.Debug("Lamba Machine Local Version: ", app.Version)
10894

10995
app.Flags = []cli.Flag{
11096
cli.BoolFlag{
@@ -117,30 +103,6 @@ func main() {
117103
Value: mcndirs.GetBaseDir(),
118104
Usage: "Configures storage path",
119105
},
120-
cli.StringFlag{
121-
EnvVar: "MACHINE_TLS_CA_CERT",
122-
Name: "tls-ca-cert",
123-
Usage: "CA to verify remotes against",
124-
Value: "",
125-
},
126-
cli.StringFlag{
127-
EnvVar: "MACHINE_TLS_CA_KEY",
128-
Name: "tls-ca-key",
129-
Usage: "Private key to generate certificates",
130-
Value: "",
131-
},
132-
cli.StringFlag{
133-
EnvVar: "MACHINE_TLS_CLIENT_CERT",
134-
Name: "tls-client-cert",
135-
Usage: "Client cert to use for TLS",
136-
Value: "",
137-
},
138-
cli.StringFlag{
139-
EnvVar: "MACHINE_TLS_CLIENT_KEY",
140-
Name: "tls-client-key",
141-
Usage: "Private key used in client TLS auth",
142-
Value: "",
143-
},
144106
cli.StringFlag{
145107
EnvVar: "MACHINE_GITHUB_API_TOKEN",
146108
Name: "github-api-token",
@@ -167,36 +129,8 @@ func main() {
167129

168130
func runDriver(driverName string) {
169131
switch driverName {
170-
case "amazonec2":
171-
plugin.RegisterDriver(amazonec2.NewDriver("", ""))
172-
case "azure":
173-
plugin.RegisterDriver(azure.NewDriver("", ""))
174-
case "digitalocean":
175-
plugin.RegisterDriver(digitalocean.NewDriver("", ""))
176-
case "exoscale":
177-
plugin.RegisterDriver(exoscale.NewDriver("", ""))
178-
case "generic":
179-
plugin.RegisterDriver(generic.NewDriver("", ""))
180-
case "google":
181-
plugin.RegisterDriver(google.NewDriver("", ""))
182-
case "hyperv":
183-
plugin.RegisterDriver(hyperv.NewDriver("", ""))
184-
case "none":
185-
plugin.RegisterDriver(none.NewDriver("", ""))
186-
case "openstack":
187-
plugin.RegisterDriver(openstack.NewDriver("", ""))
188-
case "rackspace":
189-
plugin.RegisterDriver(rackspace.NewDriver("", ""))
190-
case "softlayer":
191-
plugin.RegisterDriver(softlayer.NewDriver("", ""))
192132
case "virtualbox":
193133
plugin.RegisterDriver(virtualbox.NewDriver("", ""))
194-
case "vmwarefusion":
195-
plugin.RegisterDriver(vmwarefusion.NewDriver("", ""))
196-
case "vmwarevcloudair":
197-
plugin.RegisterDriver(vmwarevcloudair.NewDriver("", ""))
198-
case "vmwarevsphere":
199-
plugin.RegisterDriver(vmwarevsphere.NewDriver("", ""))
200134
default:
201135
fmt.Fprintf(os.Stderr, "Unsupported driver: %s\n", driverName)
202136
os.Exit(1)

cmd/machine_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import (
44
"os"
55
"testing"
66

7-
"github.com/docker/machine/commands/mcndirs"
7+
"github.com/lambda-linux/lambda-machine-local/commands/mcndirs"
88
)
99

1010
func TestStorePathSetCorrectly(t *testing.T) {
1111
mcndirs.BaseDir = ""
12-
os.Args = []string{"docker-machine", "--storage-path", "/tmp/foo"}
12+
os.Args = []string{"lambda-machine-local", "--storage-path", "/tmp/foo"}
1313
main()
1414
if mcndirs.BaseDir != "/tmp/foo" {
1515
t.Fatal("Expected MACHINE_STORAGE_PATH environment variable to be /tmp/foo but was ", os.Getenv("MACHINE_STORAGE_PATH"))

0 commit comments

Comments
 (0)