Change "channel" to "communicate" in all guests
This commit is contained in:
parent
f9a843ddd0
commit
bb97351060
|
@ -21,10 +21,10 @@ module VagrantPlugins
|
|||
|
||||
# Remove any previous vagrant configuration in this network
|
||||
# interface's configuration files.
|
||||
vm.channel.sudo("touch #{network_scripts_dir}/ifcfg-p7p#{network[:interface]}")
|
||||
vm.channel.sudo("sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' #{network_scripts_dir}/ifcfg-p7p#{network[:interface]} > /tmp/vagrant-ifcfg-p7p#{network[:interface]}")
|
||||
vm.channel.sudo("cat /tmp/vagrant-ifcfg-p7p#{network[:interface]} > #{network_scripts_dir}/ifcfg-p7p#{network[:interface]}")
|
||||
vm.channel.sudo("rm /tmp/vagrant-ifcfg-p7p#{network[:interface]}")
|
||||
vm.communicate.sudo("touch #{network_scripts_dir}/ifcfg-p7p#{network[:interface]}")
|
||||
vm.communicate.sudo("sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' #{network_scripts_dir}/ifcfg-p7p#{network[:interface]} > /tmp/vagrant-ifcfg-p7p#{network[:interface]}")
|
||||
vm.communicate.sudo("cat /tmp/vagrant-ifcfg-p7p#{network[:interface]} > #{network_scripts_dir}/ifcfg-p7p#{network[:interface]}")
|
||||
vm.communicate.sudo("rm /tmp/vagrant-ifcfg-p7p#{network[:interface]}")
|
||||
|
||||
# Render and upload the network entry file to a deterministic
|
||||
# temporary location.
|
||||
|
@ -36,17 +36,17 @@ module VagrantPlugins
|
|||
temp.write(entry)
|
||||
temp.close
|
||||
|
||||
vm.channel.upload(temp.path, "/tmp/vagrant-network-entry_#{network[:interface]}")
|
||||
vm.communicate.upload(temp.path, "/tmp/vagrant-network-entry_#{network[:interface]}")
|
||||
end
|
||||
|
||||
# Bring down all the interfaces we're reconfiguring. By bringing down
|
||||
# each specifically, we avoid reconfiguring p7p (the NAT interface) so
|
||||
# SSH never dies.
|
||||
interfaces.each do |interface|
|
||||
vm.channel.sudo("/sbin/ifdown p7p#{interface} 2> /dev/null", :error_check => false)
|
||||
vm.channel.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-p7p#{interface}")
|
||||
vm.channel.sudo("rm /tmp/vagrant-network-entry_#{interface}")
|
||||
vm.channel.sudo("/sbin/ifup p7p#{interface} 2> /dev/null")
|
||||
vm.communicate.sudo("/sbin/ifdown p7p#{interface} 2> /dev/null", :error_check => false)
|
||||
vm.communicate.sudo("cat /tmp/vagrant-network-entry_#{interface} >> #{network_scripts_dir}/ifcfg-p7p#{interface}")
|
||||
vm.communicate.sudo("rm /tmp/vagrant-network-entry_#{interface}")
|
||||
vm.communicate.sudo("/sbin/ifup p7p#{interface} 2> /dev/null")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -60,10 +60,10 @@ module VagrantPlugins
|
|||
|
||||
def change_host_name(name)
|
||||
# Only do this if the hostname is not already set
|
||||
if !vm.channel.test("sudo hostname | grep '#{name}'")
|
||||
vm.channel.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network")
|
||||
vm.channel.sudo("hostname #{name}")
|
||||
vm.channel.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
||||
if !vm.communicate.test("sudo hostname | grep '#{name}'")
|
||||
vm.communicate.sudo("sed -i 's/\\(HOSTNAME=\\).*/\\1#{name}/' /etc/sysconfig/network")
|
||||
vm.communicate.sudo("hostname #{name}")
|
||||
vm.communicate.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def halt
|
||||
vm.channel.sudo("shutdown -p now")
|
||||
vm.communicate.sudo("shutdown -p now")
|
||||
end
|
||||
|
||||
# TODO: vboxsf is currently unsupported in FreeBSD, if you are able to
|
||||
|
@ -28,14 +28,14 @@ module VagrantPlugins
|
|||
|
||||
def mount_nfs(ip, folders)
|
||||
folders.each do |name, opts|
|
||||
vm.channel.sudo("mkdir -p #{opts[:guestpath]}")
|
||||
vm.channel.sudo("mount #{ip}:#{opts[:hostpath]} #{opts[:guestpath]}")
|
||||
vm.communicate.sudo("mkdir -p #{opts[:guestpath]}")
|
||||
vm.communicate.sudo("mount #{ip}:#{opts[:hostpath]} #{opts[:guestpath]}")
|
||||
end
|
||||
end
|
||||
|
||||
def configure_networks(networks)
|
||||
# Remove any previous network additions to the configuration file.
|
||||
vm.channel.sudo("sed -i '' -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf")
|
||||
vm.communicate.sudo("sed -i '' -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/rc.conf")
|
||||
|
||||
networks.each do |network|
|
||||
entry = TemplateRenderer.render("guests/freebsd/network_#{network[:type]}",
|
||||
|
@ -47,22 +47,22 @@ module VagrantPlugins
|
|||
temp.write(entry)
|
||||
temp.close
|
||||
|
||||
vm.channel.upload(temp.path, "/tmp/vagrant-network-entry")
|
||||
vm.channel.sudo("su -m root -c 'cat /tmp/vagrant-network-entry >> /etc/rc.conf'")
|
||||
vm.channel.sudo("rm /tmp/vagrant-network-entry")
|
||||
vm.communicate.upload(temp.path, "/tmp/vagrant-network-entry")
|
||||
vm.communicate.sudo("su -m root -c 'cat /tmp/vagrant-network-entry >> /etc/rc.conf'")
|
||||
vm.communicate.sudo("rm /tmp/vagrant-network-entry")
|
||||
|
||||
if network[:type].to_sym == :static
|
||||
vm.channel.sudo("ifconfig em#{network[:interface]} inet #{network[:ip]} netmask #{network[:netmask]}")
|
||||
vm.communicate.sudo("ifconfig em#{network[:interface]} inet #{network[:ip]} netmask #{network[:netmask]}")
|
||||
elsif network[:type].to_sym == :dhcp
|
||||
vm.channel.sudo("dhclient em#{network[:interface]}")
|
||||
vm.communicate.sudo("dhclient em#{network[:interface]}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def change_host_name(name)
|
||||
if !vm.channel.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'")
|
||||
vm.channel.sudo("sed -i '' 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf")
|
||||
vm.channel.sudo("hostname #{name}")
|
||||
if !vm.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'")
|
||||
vm.communicate.sudo("sed -i '' 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf")
|
||||
vm.communicate.sudo("hostname #{name}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,9 +13,9 @@ module VagrantPlugins
|
|||
|
||||
def configure_networks(networks)
|
||||
# Remove any previous host only network additions to the interface file
|
||||
vm.channel.sudo("sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/conf.d/net > /tmp/vagrant-network-interfaces")
|
||||
vm.channel.sudo("cat /tmp/vagrant-network-interfaces > /etc/conf.d/net")
|
||||
vm.channel.sudo("rm /tmp/vagrant-network-interfaces")
|
||||
vm.communicate.sudo("sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/conf.d/net > /tmp/vagrant-network-interfaces")
|
||||
vm.communicate.sudo("cat /tmp/vagrant-network-interfaces > /etc/conf.d/net")
|
||||
vm.communicate.sudo("rm /tmp/vagrant-network-interfaces")
|
||||
|
||||
# Configure each network interface
|
||||
networks.each do |network|
|
||||
|
@ -28,22 +28,22 @@ module VagrantPlugins
|
|||
temp.write(entry)
|
||||
temp.close
|
||||
|
||||
vm.channel.upload(temp.path, "/tmp/vagrant-network-entry")
|
||||
vm.communicate.upload(temp.path, "/tmp/vagrant-network-entry")
|
||||
|
||||
# Configure the interface
|
||||
vm.channel.sudo("ln -fs /etc/init.d/net.lo /etc/init.d/net.eth#{network[:interface]}")
|
||||
vm.channel.sudo("/etc/init.d/net.eth#{network[:interface]} stop 2> /dev/null")
|
||||
vm.channel.sudo("cat /tmp/vagrant-network-entry >> /etc/conf.d/net")
|
||||
vm.channel.sudo("rm /tmp/vagrant-network-entry")
|
||||
vm.channel.sudo("/etc/init.d/net.eth#{network[:interface]} start")
|
||||
vm.communicate.sudo("ln -fs /etc/init.d/net.lo /etc/init.d/net.eth#{network[:interface]}")
|
||||
vm.communicate.sudo("/etc/init.d/net.eth#{network[:interface]} stop 2> /dev/null")
|
||||
vm.communicate.sudo("cat /tmp/vagrant-network-entry >> /etc/conf.d/net")
|
||||
vm.communicate.sudo("rm /tmp/vagrant-network-entry")
|
||||
vm.communicate.sudo("/etc/init.d/net.eth#{network[:interface]} start")
|
||||
end
|
||||
end
|
||||
|
||||
def change_host_name(name)
|
||||
if !vm.channel.test("sudo hostname --fqdn | grep '#{name}'")
|
||||
vm.channel.sudo("echo 'hostname=#{name.split('.')[0]}' > /etc/conf.d/hostname")
|
||||
vm.channel.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
||||
vm.channel.sudo("hostname #{name.split('.')[0]}")
|
||||
if !vm.communicate.test("sudo hostname --fqdn | grep '#{name}'")
|
||||
vm.communicate.sudo("echo 'hostname=#{name.split('.')[0]}' > /etc/conf.d/hostname")
|
||||
vm.communicate.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
|
||||
vm.communicate.sudo("hostname #{name.split('.')[0]}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -6,7 +6,7 @@ module VagrantPlugins
|
|||
module GuestOpenBSD
|
||||
class Guest < VagrantPlugins::GuestLinux::Guest
|
||||
def halt
|
||||
vm.channel.sudo("shutdown -p -h now")
|
||||
vm.communicate.sudo("shutdown -p -h now")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -17,14 +17,14 @@ module VagrantPlugins
|
|||
su_cmd = vm.config.solaris.suexec_cmd
|
||||
ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}"
|
||||
|
||||
vm.channel.execute("#{ifconfig_cmd} plumb")
|
||||
vm.communicate.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}\"")
|
||||
vm.communicate.execute("#{ifconfig_cmd} inet #{network[:ip]} netmask #{network[:netmask]}")
|
||||
vm.communicate.execute("#{ifconfig_cmd} up")
|
||||
vm.communicate.execute("#{su_cmd} sh -c \"echo '#{network[:ip]}' > /etc/hostname.#{device}\"")
|
||||
elsif network[:type].to_sym == :dhcp
|
||||
vm.channel.execute("#{ifconfig_cmd} dhcp start")
|
||||
vm.communicate.execute("#{ifconfig_cmd} dhcp start")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -33,9 +33,9 @@ module VagrantPlugins
|
|||
su_cmd = vm.config.solaris.suexec_cmd
|
||||
|
||||
# Only do this if the hostname is not already set
|
||||
if !vm.channel.test("#{su_cmd} hostname | grep '#{name}'")
|
||||
vm.channel.execute("#{su_cmd} sh -c \"echo '#{name}' > /etc/nodename\"")
|
||||
vm.channel.execute("#{su_cmd} uname -S #{name}")
|
||||
if !vm.communicate.test("#{su_cmd} hostname | grep '#{name}'")
|
||||
vm.communicate.execute("#{su_cmd} sh -c \"echo '#{name}' > /etc/nodename\"")
|
||||
vm.communicate.execute("#{su_cmd} uname -S #{name}")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -45,7 +45,7 @@ module VagrantPlugins
|
|||
#
|
||||
# does not exist in /etc/user_attr. TODO
|
||||
def halt
|
||||
vm.channel.execute("#{vm.config.solaris.suexec_cmd} /usr/sbin/poweroff")
|
||||
vm.communicate.execute("#{vm.config.solaris.suexec_cmd} /usr/sbin/poweroff")
|
||||
end
|
||||
|
||||
def mount_shared_folder(name, guestpath, options)
|
||||
|
@ -54,7 +54,7 @@ module VagrantPlugins
|
|||
group = options[:group]
|
||||
|
||||
# Create the shared folder
|
||||
vm.channel.execute("#{vm.config.solaris.suexec_cmd} mkdir -p #{guestpath}")
|
||||
vm.communicate.execute("#{vm.config.solaris.suexec_cmd} mkdir -p #{guestpath}")
|
||||
|
||||
# We have to use this `id` command instead of `/usr/bin/id` since this
|
||||
# one accepts the "-u" and "-g" flags.
|
||||
|
@ -63,10 +63,10 @@ module VagrantPlugins
|
|||
# Mount the folder with the proper owner/group
|
||||
mount_options = "-o uid=`#{id_cmd} -u #{owner}`,gid=`#{id_cmd} -g #{group}`"
|
||||
mount_options += ",#{options[:extra]}" if options[:extra]
|
||||
vm.channel.execute("#{vm.config.solaris.suexec_cmd} /sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}")
|
||||
vm.communicate.execute("#{vm.config.solaris.suexec_cmd} /sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}")
|
||||
|
||||
# chown the folder to the proper owner/group
|
||||
vm.channel.execute("#{vm.config.solaris.suexec_cmd} chown `#{id_cmd} -u #{owner}`:`#{id_cmd} -g #{group}` #{guestpath}")
|
||||
vm.communicate.execute("#{vm.config.solaris.suexec_cmd} chown `#{id_cmd} -u #{owner}`:`#{id_cmd} -g #{group}` #{guestpath}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,7 +20,7 @@ module VagrantPlugins
|
|||
# Emit an upstart events if upstart is available
|
||||
folders.each do |name, opts|
|
||||
real_guestpath = expanded_guest_path(opts[:guestpath])
|
||||
vm.channel.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{real_guestpath}")
|
||||
vm.communicate.sudo("[ -x /sbin/initctl ] && /sbin/initctl emit vagrant-mounted MOUNTPOINT=#{real_guestpath}")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue