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]}"
su_cmd = vm.config.solaris.suexec_cmd
ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}"
def enable_host_only_network(net_options) vm.channel.execute("#{ifconfig_cmd} plumb")
device = "#{vm.config.solaris.device}#{net_options[:adapter]}"
su_cmd = vm.config.solaris.suexec_cmd if network[:type].to_sym == :static
ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}" vm.channel.execute("#{ifconfig_cmd} inet #{network[:ip]} netmask #{network[:netmask]}")
vm.ssh.execute do |ssh| vm.channel.execute("#{ifconfig_cmd} up")
ssh.exec!("#{ifconfig_cmd} plumb") vm.channel.execute("#{su_cmd} sh -c \"echo '#{network[:ip]}' > /etc/hostname.#{device}\"")
ssh.exec!("#{ifconfig_cmd} inet #{net_options[:ip]} netmask #{net_options[:netmask]}") elsif network[:type].to_sym == :dhcp
ssh.exec!("#{ifconfig_cmd} up") vm.channel.execute("#{ifconfig_cmd} dhcp start")
ssh.exec!("#{su_cmd} sh -c \"echo '#{net_options[:ip]}' > /etc/hostname.#{device}\"") end
end end
end end