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:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user