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