@@ -1045,31 +1045,28 @@ def zonecfgnicconfig(uii, opts)
1045
1045
defrouter = opts [ :gateway ] . to_s
1046
1046
vnic_name = vname ( uii , opts )
1047
1047
config = @machine . provider_config
1048
+
1048
1049
uii . info ( I18n . t ( 'vagrant_zones.vnic_setup' ) )
1049
1050
uii . info ( " #{ vnic_name } " )
1051
+
1050
1052
strt = "#{ @pfexec } zonecfg -z #{ @machine . name } "
1051
1053
cie = config . cloud_init_enabled
1052
1054
aa = config . allowed_address
1053
-
1055
+
1054
1056
case config . brand
1055
1057
when 'lx'
1056
1058
shrtstr1 = %(set allowed-address=#{ allowed_address } ; add property (name=gateway,value="#{ defrouter } "); )
1057
1059
shrtstr2 = %(add property (name=ips,value="#{ allowed_address } "); add property (name=primary,value="true"); end;)
1058
1060
execute ( false , %(#{ strt } set global-nic=auto; #{ shrtstr1 } #{ shrtstr2 } ") )
1059
1061
when 'bhyve'
1060
- vlan_option = opts [ :vlan ] . nil? || ( opts [ :vlan ] ) . zero? ? '' : "set vlan-id=#{ opts [ :vlan ] } ; "
1061
-
1062
- if config . on_demand_vnics
1063
- base_cmd = %(#{ strt } "add net; set physical=#{ vnic_name } ; #{ vlan_option } set global-nic=#{ opts [ :bridge ] } ; )
1064
- execute ( false , %(#{ base_cmd } end;") ) unless cie
1065
- execute ( false , %(#{ base_cmd } set allowed-address=#{ allowed_address } ; end;") ) if cie && aa
1066
- execute ( false , %(#{ base_cmd } end;") ) if cie && !aa
1067
- else
1068
- base_cmd = %(#{ strt } "add net; set physical=#{ vnic_name } ; )
1069
- execute ( false , %(#{ base_cmd } end;") ) unless cie
1070
- execute ( false , %(#{ base_cmd } set allowed-address=#{ allowed_address } ; end;") ) if cie && aa
1071
- execute ( false , %(#{ base_cmd } end;") ) if cie && !aa
1072
- end
1062
+ vlan_option = opts [ :vlan ] . nil? || opts [ :vlan ] . zero? ? '' : "set vlan-id=#{ opts [ :vlan ] } ; "
1063
+ base_cmd = config . on_demand_vnics ? \
1064
+ %(#{ strt } "add net; set physical=#{ vnic_name } ; #{ vlan_option } set global-nic=#{ opts [ :bridge ] } ; ) : \
1065
+ %(#{ strt } "add net; set physical=#{ vnic_name } ; )
1066
+
1067
+ execute ( false , %(#{ base_cmd } end;) ) unless cie
1068
+ execute ( false , %(#{ base_cmd } set allowed-address=#{ allowed_address } ; end;) ) if cie && aa
1069
+ execute ( false , %(#{ base_cmd } end;) ) if cie && !aa
1073
1070
end
1074
1071
end
1075
1072
0 commit comments