cloudstack: Add default cidr_list [ 0.0.0.0/0 ]

This commit is contained in:
Rickard von Essen 2017-07-14 07:50:54 +02:00
parent 587d661c74
commit 89b9b4c456
No known key found for this signature in database
GPG Key ID: E0C0327388876CBA
3 changed files with 10 additions and 11 deletions

View File

@ -83,6 +83,10 @@ func NewConfig(raws ...interface{}) (*Config, error) {
c.AsyncTimeout = 30 * time.Minute
}
if len(c.CIDRList) == 0 && !c.UseLocalIPAddress {
c.CIDRList = []string{"0.0.0.0/0"}
}
if c.InstanceName == "" {
c.InstanceName = fmt.Sprintf("packer-%s", uuid.TimeOrderedUUID())
}
@ -114,10 +118,6 @@ func NewConfig(raws ...interface{}) (*Config, error) {
errs = packer.MultiErrorAppend(errs, errors.New("a secret_key must be specified"))
}
if len(c.CIDRList) == 0 && !c.UseLocalIPAddress {
errs = packer.MultiErrorAppend(errs, errors.New("a cidr_list must be specified"))
}
if c.Network == "" {
errs = packer.MultiErrorAppend(errs, errors.New("a network must be specified"))
}

View File

@ -38,7 +38,7 @@ func TestNewConfig(t *testing.T) {
"source_template": "d31e6af5-94a8-4756-abf3-6493c38db7e5",
},
Nullify: "cidr_list",
Err: true,
Err: false,
},
"no_cidr_list_with_use_local_ip_address": {
Config: map[string]interface{}{

View File

@ -37,11 +37,6 @@ builder.
- `api_key` (string) - The API key used to sign all API requests.
- `cidr_list` (array) - List of CIDR's that will have access to the new
instance. This is needed in order for any provisioners to be able to
connect to the instance. Usually this will be the NAT address of your
current location. Only required when `use_local_ip_address` is `false`.
- `instance_name` (string) - The name of the instance. Defaults to
"packer-UUID" where UUID is dynamically generated.
@ -76,6 +71,11 @@ builder.
- `async_timeout` (int) - The time duration to wait for async calls to
finish. Defaults to 30m.
- `cidr_list` (array) - List of CIDR's that will have access to the new
instance. This is needed in order for any provisioners to be able to
connect to the instance. Defaults to `[ "0.0.0.0/0" ]`. Only required
when `use_local_ip_address` is `false`.
- `disk_offering` (string) - The name or ID of the disk offering used for the
instance. This option is only available (and also required) when using
`source_iso`.
@ -161,7 +161,6 @@ Here is a basic example.
"secret_key": "YOUR_SECRET_KEY",
"disk_offering": "Small - 20GB",
"cidr_list": ["0.0.0.0/0"],
"hypervisor": "KVM",
"network": "management",
"service_offering": "small",