mirror of
https://github.com/hashicorp/vagrant.git
synced 2026-05-28 04:36:05 -04:00
add static route configuration for redhat guests
This commit is contained in:
parent
d0d6d01e24
commit
da010cddcf
2 changed files with 24 additions and 0 deletions
|
|
@ -48,6 +48,23 @@ module VagrantPlugins
|
|||
raise Vagrant::Errors::NetworkManagerNotInstalled, device: network[:device]
|
||||
end
|
||||
|
||||
# Render static route file if present
|
||||
if network.key?(:route) && network[:route] != nil
|
||||
routeentry = TemplateRenderer.render("guests/redhat/network_route",
|
||||
routes: network[:route],
|
||||
)
|
||||
route_remote_path = "/tmp/vagrant-network-route-entry-#{network[:device]}-#{Time.now.to_i}-#{i}"
|
||||
Tempfile.open("vagrant-redhat-configure-networks-routes") do |f|
|
||||
f.binmode
|
||||
f.write(routeentry)
|
||||
f.fsync
|
||||
f.close
|
||||
machine.communicate.upload(f.path, route_remote_path)
|
||||
end
|
||||
route_final_path = "#{network_scripts_dir}/route-#{network[:device]}"
|
||||
commands[:middle] << "mv -f '#{route_remote_path}' '#{route_final_path}'"
|
||||
end
|
||||
|
||||
# Render a new configuration
|
||||
entry = TemplateRenderer.render("guests/redhat/network_#{network[:type]}",
|
||||
options: extra_opts.merge(network),
|
||||
|
|
|
|||
7
templates/guests/redhat/network_route.erb
Normal file
7
templates/guests/redhat/network_route.erb
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
#VAGRANT-BEGIN
|
||||
# The contents below are automatically generated by Vagrant. Do not modify.
|
||||
# <%= routes.inspect %>
|
||||
<% routes.split(';').each do |route| %>
|
||||
<%= route %>
|
||||
<% end %>
|
||||
#VAGRANT-END
|
||||
Loading…
Reference in a new issue