diff --git a/commands/commands.go b/commands/commands.go index b512585a..0eb4ae09 100644 --- a/commands/commands.go +++ b/commands/commands.go @@ -156,20 +156,8 @@ func getFirstArgHost(c CommandLine) (*host.Host, error) { store := getStore(c) hostName := c.Args().First() - exists, err := store.Exists(hostName) - if err != nil { - return nil, fmt.Errorf("Error checking if host %q exists: %s", hostName, err) - } - if !exists { - return nil, fmt.Errorf("Host %q does not exist", hostName) - } - h, err := loadHost(store, hostName) if err != nil { - // I guess I feel OK with bailing here since if we can't get - // the host reliably we're definitely not going to be able to - // do anything else interesting, but also this premature exit - // feels wrong to me. Let's revisit it later. return nil, fmt.Errorf("Error trying to get host %q: %s", hostName, err) } diff --git a/commands/commands_test.go b/commands/commands_test.go index 93d451c8..517cbc2d 100644 --- a/commands/commands_test.go +++ b/commands/commands_test.go @@ -8,7 +8,6 @@ import ( "github.com/docker/machine/drivers/fakedriver" "github.com/docker/machine/libmachine/host" "github.com/docker/machine/libmachine/hosttest" - "github.com/docker/machine/libmachine/persisttest" "github.com/docker/machine/libmachine/state" "github.com/stretchr/testify/assert" ) @@ -104,7 +103,7 @@ func TestRunActionForeachMachine(t *testing.T) { } func TestPrintIPEmptyGivenLocalEngine(t *testing.T) { - defer persisttest.Cleanup() + defer cleanup() host, _ := hosttest.GetDefaultTestHost() out, w := captureStdout() diff --git a/libmachine/hosttest/default_test_host.go b/libmachine/hosttest/default_test_host.go index 32f24031..143a1201 100644 --- a/libmachine/hosttest/default_test_host.go +++ b/libmachine/hosttest/default_test_host.go @@ -11,7 +11,6 @@ import ( const ( DefaultHostName = "test-host" - HostTestDriverName = "none" HostTestCaCert = "test-cert" HostTestPrivateKey = "test-key" ) diff --git a/libmachine/mcnerror/errors.go b/libmachine/mcnerror/errors.go index 70527655..61d8d2a4 100644 --- a/libmachine/mcnerror/errors.go +++ b/libmachine/mcnerror/errors.go @@ -6,8 +6,7 @@ import ( ) var ( - ErrInvalidHostname = errors.New("Invalid hostname specified. Allowed hostname chars are: 0-9a-zA-Z . -") - ErrUnknownProviderType = errors.New("Unknown hypervisor type") + ErrInvalidHostname = errors.New("Invalid hostname specified. Allowed hostname chars are: 0-9a-zA-Z . -") ) type ErrHostDoesNotExist struct { diff --git a/libmachine/persisttest/default_test_store.go b/libmachine/persisttest/default_test_store.go deleted file mode 100644 index 96b1dbe2..00000000 --- a/libmachine/persisttest/default_test_store.go +++ /dev/null @@ -1,34 +0,0 @@ -package persisttest - -import ( - "fmt" - "io/ioutil" - "os" - - "github.com/docker/machine/libmachine/hosttest" - "github.com/docker/machine/libmachine/persist" -) - -var ( - TestStoreDir = "" -) - -func Cleanup() error { - return os.RemoveAll(TestStoreDir) -} - -func GetDefaultTestStore() (persist.Filestore, error) { - tmpDir, err := ioutil.TempDir("", "machine-test-") - if err != nil { - fmt.Println(err) - os.Exit(1) - } - - TestStoreDir = tmpDir - - return persist.Filestore{ - Path: tmpDir, - CaCertPath: hosttest.HostTestCaCert, - CaPrivateKeyPath: hosttest.HostTestPrivateKey, - }, nil -}