mirror of https://github.com/docker/docs.git
Remove unused code
Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
parent
89675067eb
commit
8bbfc6ef2a
|
@ -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)
|
||||
}
|
||||
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
|
||||
const (
|
||||
DefaultHostName = "test-host"
|
||||
HostTestDriverName = "none"
|
||||
HostTestCaCert = "test-cert"
|
||||
HostTestPrivateKey = "test-key"
|
||||
)
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
Loading…
Reference in New Issue