mirror of
https://github.com/docker/docs.git
synced 2026-03-31 16:28:59 +07:00
Merge pull request #267 from sthulb/create-oops
Stop machine from overwriting an existing machine
This commit is contained in:
13
commands.go
13
commands.go
@@ -182,6 +182,17 @@ func cmdCreate(c *cli.Context) {
|
||||
log.Fatal("You must specify a machine name")
|
||||
}
|
||||
|
||||
store := NewStore(c.GlobalString("storage-path"))
|
||||
|
||||
exists, err := store.Exists(name)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
if exists {
|
||||
log.Fatal("There's already a machine with the same name")
|
||||
}
|
||||
|
||||
keyExists, err := drivers.PublicKeyExists()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
@@ -191,8 +202,6 @@ func cmdCreate(c *cli.Context) {
|
||||
log.Fatalf("Identity authentication public key doesn't exist at %q. Create your public key by running the \"docker\" command.", drivers.PublicKeyPath())
|
||||
}
|
||||
|
||||
store := NewStore(c.GlobalString("storage-path"))
|
||||
|
||||
host, err := store.Create(name, driver, c)
|
||||
if err != nil {
|
||||
log.Errorf("Error creating host: %s", err)
|
||||
|
||||
Reference in New Issue
Block a user