1
0
mirror of https://github.com/docker/docs.git synced 2026-11-05 00:14:17 +03:00

GetURL() should fail is the machine is stopped

Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
David Gageot
2015-11-19 11:23:55 +01:00
parent 01f3a45530
commit 5aa2179807

View File

@@ -229,10 +229,19 @@ func (d *Driver) GetURL() (string, error) {
// GetIP returns the IP address of the GCE instance.
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)
if err != nil {
return "", err
}
return c.ip()
}