mirror of https://github.com/docker/docs.git
Revert "Remove duplication over GetIP"
This reverts commit 99aacc7b79
.
Signed-off-by: David Gageot <david@gageot.net>
This commit is contained in:
parent
a7559fd3a8
commit
57dc1156de
|
@ -226,6 +226,13 @@ func (d *Driver) GetURL() (string, error) {
|
||||||
return fmt.Sprintf("tcp://%s:2376", ip), nil
|
return fmt.Sprintf("tcp://%s:2376", ip), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Driver) GetIP() (string, error) {
|
||||||
|
if d.IPAddress == "" {
|
||||||
|
return "", fmt.Errorf("IP address is not set")
|
||||||
|
}
|
||||||
|
return d.IPAddress, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (d *Driver) GetState() (state.State, error) {
|
func (d *Driver) GetState() (state.State, error) {
|
||||||
droplet, _, err := d.getClient().Droplets.Get(d.DropletID)
|
droplet, _, err := d.getClient().Droplets.Get(d.DropletID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -146,6 +146,13 @@ func (d *Driver) GetURL() (string, error) {
|
||||||
return fmt.Sprintf("tcp://%s:2376", ip), nil
|
return fmt.Sprintf("tcp://%s:2376", ip), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Driver) GetIP() (string, error) {
|
||||||
|
if d.IPAddress == "" {
|
||||||
|
return "", fmt.Errorf("IP address is not set")
|
||||||
|
}
|
||||||
|
return d.IPAddress, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (d *Driver) GetState() (state.State, error) {
|
func (d *Driver) GetState() (state.State, error) {
|
||||||
client := egoscale.NewClient(d.URL, d.ApiKey, d.ApiSecretKey)
|
client := egoscale.NewClient(d.URL, d.ApiKey, d.ApiSecretKey)
|
||||||
vm, err := client.GetVirtualMachine(d.Id)
|
vm, err := client.GetVirtualMachine(d.Id)
|
||||||
|
|
|
@ -121,7 +121,11 @@ func (d *Driver) GetURL() (string, error) {
|
||||||
return fmt.Sprintf("tcp://%s:2376", ip), nil
|
return fmt.Sprintf("tcp://%s:2376", ip), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (d *Driver) GetIP() (string, error) {
|
||||||
|
if d.IPAddress == "" {
|
||||||
|
return "", fmt.Errorf("IP address is not set")
|
||||||
}
|
}
|
||||||
|
return d.IPAddress, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *Driver) GetState() (state.State, error) {
|
func (d *Driver) GetState() (state.State, error) {
|
||||||
|
|
|
@ -26,16 +26,6 @@ func (d *BaseDriver) DriverName() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIP returns the ip
|
// GetIP returns the ip
|
||||||
func (d *BaseDriver) GetIP() (string, error) {
|
|
||||||
if d.IPAddress == "" {
|
|
||||||
return "", fmt.Errorf("IP address is not set")
|
|
||||||
}
|
|
||||||
ip := net.ParseIP(d.IPAddress)
|
|
||||||
if ip == nil {
|
|
||||||
return "", fmt.Errorf("IP address is invalid")
|
|
||||||
}
|
|
||||||
return d.IPAddress, nil
|
|
||||||
}
|
|
||||||
func (d *BaseDriver) GetMachineName() string {
|
func (d *BaseDriver) GetMachineName() string {
|
||||||
return d.MachineName
|
return d.MachineName
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue