Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

b-515: Corrects vlan_id prevalence in vnet creation #581

Open
wants to merge 1 commit into
base: B-515-ignored-vlanid
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions opennebula/resource_opennebula_virtual_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -802,16 +802,11 @@ func generateVn(d *schema.ResourceData) (string, error) {
tpl.Add(vnk.Name, vnname)
tpl.Add(vnk.VNMad, vnmad)

vlanSet := false
if d.Get("automatic_vlan_id").(bool) {
if vlanID, ok := d.GetOk("vlan_id"); ok {
tpl.Add(vnk.VlanID, vlanID.(string))
} else if d.Get("automatic_vlan_id").(bool) {
tpl.Add("AUTOMATIC_VLAN_ID", "YES")
vlanSet = true
} else if vlanid, ok := d.GetOk("vlan_id"); ok {
tpl.Add(vnk.VlanID, vlanid.(string))
vlanSet = true
}

if mandatoryVLAN(vnmad) && !vlanSet {
} else if mandatoryVLAN(vnmad) {
return "", fmt.Errorf("you must specify a 'vlan_id' or set the flag 'automatic_vlan_id'")
}

Expand Down
Loading