Update solaris networks API

This commit is contained in:
Mitchell Hashimoto 2012-01-17 11:30:21 -08:00
parent f4ea1f800c
commit 0cf619dec8
1 changed files with 14 additions and 11 deletions

View File

@ -28,18 +28,21 @@ module Vagrant
error_namespace("vagrant.guest.solaris") error_namespace("vagrant.guest.solaris")
end end
def prepare_host_only_network(net_options=nil) def configure_networks(networks)
end networks.each do |network|
device = "#{vm.config.solaris.device}#{network[:interface]}"
def enable_host_only_network(net_options)
device = "#{vm.config.solaris.device}#{net_options[:adapter]}"
su_cmd = vm.config.solaris.suexec_cmd su_cmd = vm.config.solaris.suexec_cmd
ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}" ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}"
vm.ssh.execute do |ssh|
ssh.exec!("#{ifconfig_cmd} plumb") vm.channel.execute("#{ifconfig_cmd} plumb")
ssh.exec!("#{ifconfig_cmd} inet #{net_options[:ip]} netmask #{net_options[:netmask]}")
ssh.exec!("#{ifconfig_cmd} up") if network[:type].to_sym == :static
ssh.exec!("#{su_cmd} sh -c \"echo '#{net_options[:ip]}' > /etc/hostname.#{device}\"") vm.channel.execute("#{ifconfig_cmd} inet #{network[:ip]} netmask #{network[:netmask]}")
vm.channel.execute("#{ifconfig_cmd} up")
vm.channel.execute("#{su_cmd} sh -c \"echo '#{network[:ip]}' > /etc/hostname.#{device}\"")
elsif network[:type].to_sym == :dhcp
vm.channel.execute("#{ifconfig_cmd} dhcp start")
end
end end
end end