Merge pull request #1668 from ehazlett/carry-1454-ec2-private-address

Amazon Ec2 - Add the option amazonec2-use-private-address
This commit is contained in:
Evan Hazlett 2015-08-11 07:32:23 -04:00
commit cf10bf45b5
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,
},
}