exoscale: use StringSlice to specify security groups
This mean that the option has to be repeated to specify multiple security groups. Signed-off-by: Vincent Bernat <Vincent.Bernat@exoscale.ch>
This commit is contained in:
@@ -112,6 +112,10 @@ func (d DriverOptionsMock) String(key string) string {
|
||||
return d.Data[key].(string)
|
||||
}
|
||||
|
||||
func (d DriverOptionsMock) StringSlice(key string) []string {
|
||||
return d.Data[key].([]string)
|
||||
}
|
||||
|
||||
func (d DriverOptionsMock) Int(key string) int {
|
||||
return d.Data[key].(int)
|
||||
}
|
||||
|
||||
@@ -1174,7 +1174,7 @@ Options:
|
||||
- `--exoscale-instance-profile`: Instance profile.
|
||||
- `--exoscale-disk-size`: Disk size for the host in GB.
|
||||
- `--exoscale-image`: exoscale disk size. (10, 50, 100, 200, 400)
|
||||
- `--exoscale-security-group`: Comma-separated list of security groups. Non-existent groups will be created.
|
||||
- `--exoscale-security-group`: Security group. Non-existent groups will be created. Can be repeated.
|
||||
- `--exoscale-availability-zone`: exoscale availability zone.
|
||||
|
||||
If a custom security group is provided, you need to ensure that you allow TCP ports 22 and 2376 in an ingress rule. Moreover, if you want to use Swarm, also add TCP port 3376.
|
||||
|
||||
@@ -35,6 +35,10 @@ func (d DriverOptionsMock) String(key string) string {
|
||||
return d.Data[key].(string)
|
||||
}
|
||||
|
||||
func (d DriverOptionsMock) StringSlice(key string) []string {
|
||||
return d.Data[key].([]string)
|
||||
}
|
||||
|
||||
func (d DriverOptionsMock) Int(key string) int {
|
||||
return d.Data[key].(int)
|
||||
}
|
||||
|
||||
@@ -164,6 +164,7 @@ func GetDriverNames() []string {
|
||||
|
||||
type DriverOptions interface {
|
||||
String(key string) string
|
||||
StringSlice(key string) []string
|
||||
Int(key string) int
|
||||
Bool(key string) bool
|
||||
}
|
||||
|
||||
@@ -84,10 +84,10 @@ func GetCreateFlags() []cli.Flag {
|
||||
Value: "ubuntu-14.04",
|
||||
Usage: "exoscale image template",
|
||||
},
|
||||
cli.StringFlag{
|
||||
cli.StringSliceFlag{
|
||||
EnvVar: "EXOSCALE_SECURITY_GROUP",
|
||||
Name: "exoscale-security-group",
|
||||
Value: "docker-machine",
|
||||
Value: &cli.StringSlice{},
|
||||
Usage: "exoscale security group",
|
||||
},
|
||||
cli.StringFlag{
|
||||
@@ -142,8 +142,9 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
|
||||
d.InstanceProfile = flags.String("exoscale-instance-profile")
|
||||
d.DiskSize = flags.Int("exoscale-disk-size")
|
||||
d.Image = flags.String("exoscale-image")
|
||||
if flags.String("exoscale-security-group") != "" {
|
||||
d.SecurityGroups = strings.Split(flags.String("exoscale-security-group"), ",")
|
||||
d.SecurityGroups = flags.StringSlice("exoscale-security-group")
|
||||
if len(d.SecurityGroups) == 0 {
|
||||
d.SecurityGroups = []string{"docker-machine"}
|
||||
}
|
||||
d.AvailabilityZone = flags.String("exoscale-availability-zone")
|
||||
d.SwarmMaster = flags.Bool("swarm-master")
|
||||
|
||||
@@ -26,6 +26,13 @@ func (d DriverOptionsMock) String(key string) string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (d DriverOptionsMock) StringSlice(key string) []string {
|
||||
if value, ok := d.Data[key]; ok {
|
||||
return value.([]string)
|
||||
}
|
||||
return []string{}
|
||||
}
|
||||
|
||||
func (d DriverOptionsMock) Int(key string) int {
|
||||
if value, ok := d.Data[key]; ok {
|
||||
return value.(int)
|
||||
|
||||
@@ -17,6 +17,10 @@ func (d DriverOptionsMock) String(key string) string {
|
||||
return d.Data[key].(string)
|
||||
}
|
||||
|
||||
func (d DriverOptionsMock) StringSlice(key string) []string {
|
||||
return d.Data[key].([]string)
|
||||
}
|
||||
|
||||
func (d DriverOptionsMock) Int(key string) int {
|
||||
return d.Data[key].(int)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user