Merge pull request #5125 from rickard-von-essen/cloudstack-cidr

cloudstack: Add default cidr_list [ 0.0.0.0/0 ]
This commit is contained in:
Rickard von Essen 2017-07-14 11:14:51 +02:00 committed by GitHub
commit 4a6d029554
3 changed files with 10 additions and 11 deletions

View File

@ -98,6 +98,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())
}
@ -129,10 +133,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

@ -41,11 +41,6 @@ builder.
can also be specified via environment variable `CLOUDSTACK_API_KEY`,
if set.
- `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.
@ -82,6 +77,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`.
@ -167,7 +167,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",