Skip to content

Commit

Permalink
core: allow empty gateways
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkProminic committed Dec 9, 2022
1 parent 0b7bde1 commit 382038e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/vagrant-zones/driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1066,9 +1066,11 @@ def zoneniczloginsetup_netplan(uii, opts, mac)
uii.info(" #{vnic_name}")
netplan1 = %(network:\n version: 2\n ethernets:\n #{vnic_name}:\n match:\n macaddress: #{mac}\n)
netplan2 = %( dhcp-identifier: mac\n dhcp4: #{opts[:dhcp4]}\n dhcp6: #{opts[:dhcp6]}\n)
netplan3 = %( set-name: #{vnic_name}\n addresses: [#{ip}/#{shrtsubnet}]\n gateway4: #{defrouter}\n)
netplan4 = %( nameservers:\n addresses: [#{servers[0]['nameserver']} , #{servers[1]['nameserver']}] )
netplan = netplan1 + netplan2 + netplan3 + netplan4
netplan3 = %( set-name: #{vnic_name}\n addresses: [#{ip}/#{shrtsubnet}]\n)
netplan4 = %( gateway4: #{defrouter}\n)
netplan5 = %( nameservers:\n addresses: [#{servers[0]['nameserver']} , #{servers[1]['nameserver']}] )
netplan = netplan1 + netplan2 + netplan3 + netplan5 if opts[:gateway].nil?
netplan = netplan1 + netplan2 + netplan3 + netplan4 + netplan5 unless opts[:gateway].nil?
cmd = "echo '#{netplan}' > /etc/netplan/#{vnic_name}.yaml"
infomessage = I18n.t('vagrant_zones.netplan_applied_static') + "/etc/netplan/#{vnic_name}.yaml"
uii.info(infomessage) if zlogin(uii, cmd)
Expand Down
2 changes: 2 additions & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ en:
Invalid bhyve configuration detected
console_failed: |-
Failed to access console
console_failed: |-
Failed to apply the netplan configuration inside the VM
console_failed_exit: |-
Exiting
execute_error: |-
Expand Down

0 comments on commit 382038e

Please sign in to comment.