mirror of https://github.com/docker/docs.git
Faster google driver
Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
parent
48554182f1
commit
085fe1334a
|
@ -229,20 +229,20 @@ func (d *Driver) GetURL() (string, error) {
|
||||||
|
|
||||||
// GetIP returns the IP address of the GCE instance.
|
// GetIP returns the IP address of the GCE instance.
|
||||||
func (d *Driver) GetIP() (string, error) {
|
func (d *Driver) GetIP() (string, error) {
|
||||||
machineState, err := d.GetState()
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if machineState != state.Running {
|
|
||||||
return "", drivers.ErrHostIsNotRunning
|
|
||||||
}
|
|
||||||
|
|
||||||
c, err := newComputeUtil(d)
|
c, err := newComputeUtil(d)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.ip()
|
ip, err := c.ip()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if ip == "" {
|
||||||
|
return "", drivers.ErrHostIsNotRunning
|
||||||
|
}
|
||||||
|
|
||||||
|
return ip, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetState returns a docker.hosts.state.State value representing the current state of the host.
|
// GetState returns a docker.hosts.state.State value representing the current state of the host.
|
||||||
|
@ -254,12 +254,12 @@ func (d *Driver) GetState() (state.State, error) {
|
||||||
|
|
||||||
// All we care about is whether the disk exists, so we just check disk for a nil value.
|
// All we care about is whether the disk exists, so we just check disk for a nil value.
|
||||||
// There will be no error if disk is not nil.
|
// There will be no error if disk is not nil.
|
||||||
disk, _ := c.disk()
|
|
||||||
instance, _ := c.instance()
|
instance, _ := c.instance()
|
||||||
if instance == nil && disk == nil {
|
if instance == nil {
|
||||||
return state.None, nil
|
disk, _ := c.disk()
|
||||||
}
|
if disk == nil {
|
||||||
if instance == nil && disk != nil {
|
return state.None, nil
|
||||||
|
}
|
||||||
return state.Stopped, nil
|
return state.Stopped, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue