1
0
mirror of https://github.com/docker/docs.git synced 2026-11-06 12:54:24 +03:00

Amazon Ec2 - Add the option amazonec2-use-private-address

Signed-off-by: Rodrigo Reis <rodrigo@rodrigoreis.com>
This commit is contained in:
Rodrigo Reis
2015-07-03 00:24:23 -03:00
committed by Evan Hazlett
parent c1acb74d7a
commit 04b435c832
2 changed files with 11 additions and 0 deletions

View File

@@ -59,6 +59,7 @@ type Driver struct {
RequestSpotInstance bool
SpotPrice string
PrivateIPOnly bool
UsePrivateIP bool
Monitoring bool
}
@@ -160,6 +161,10 @@ func GetCreateFlags() []cli.Flag {
Name: "amazonec2-private-address-only",
Usage: "Only use a private IP address",
},
cli.BoolFlag{
Name: "amazonec2-use-private-address",
Usage: "Force the usage of private IP address",
},
cli.BoolFlag{
Name: "amazonec2-monitoring",
Usage: "Set this flag to enable CloudWatch monitoring",
@@ -208,6 +213,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.SSHUser = flags.String("amazonec2-ssh-user")
d.SSHPort = 22
d.PrivateIPOnly = flags.Bool("amazonec2-private-address-only")
d.UsePrivateIP = flags.Bool("amazonec2-use-private-address")
d.Monitoring = flags.Bool("amazonec2-monitoring")
if d.AccessKey == "" {
@@ -415,6 +421,10 @@ func (d *Driver) GetIP() (string, error) {
return inst.PrivateIpAddress, nil
}
if d.UsePrivateIP {
return inst.PrivateIpAddress, nil
}
return inst.IpAddress, nil
}

View File

@@ -85,6 +85,7 @@ func getDefaultTestDriverFlags() *DriverOptionsMock {
"amazonec2-request-spot-instance": false,
"amazonec2-spot-price": "",
"amazonec2-private-address-only": false,
"amazonec2-use-private-address": false,
"amazonec2-monitoring": false,
},
}