Sha256: 5e266b5191b733a007beb542aeb83ff45c160f85ed3ad94d7e389fa4ffa41f17

Contents?: true

Size: 1.43 KB

Versions: 32

Compression:

Stored size: 1.43 KB

Contents

module Vagrant
  module Systems
    class Debian < Linux
      def prepare_host_only_network(net_options=nil)
        # Remove any previous host only network additions to the
        # interface file.
        vm.ssh.execute do |ssh|
          # Clear out any previous entries
          ssh.exec!("sudo sed -e '/^#VAGRANT-BEGIN/,/^#VAGRANT-END/ d' /etc/network/interfaces > /tmp/vagrant-network-interfaces")
          ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-interfaces > /etc/network/interfaces'")
        end
      end

      def enable_host_only_network(net_options)
        entry = TemplateRenderer.render('network_entry_debian', :net_options => net_options)
        vm.ssh.upload!(StringIO.new(entry), "/tmp/vagrant-network-entry")

        vm.ssh.execute do |ssh|
          ssh.exec!("sudo /sbin/ifdown eth#{net_options[:adapter]} 2> /dev/null")
          ssh.exec!("sudo su -c 'cat /tmp/vagrant-network-entry >> /etc/network/interfaces'")
          ssh.exec!("sudo /sbin/ifup eth#{net_options[:adapter]}")
        end
      end

      def change_host_name(name)
        vm.ssh.execute do |ssh|
          if !ssh.test?("sudo hostname | grep '#{name}'")
            ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts")
            ssh.exec!("sudo sed -i 's/.*$/#{name}/' /etc/hostname")
            ssh.exec!("sudo hostname -F /etc/hostname")
          end
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 4 rubygems

Version Path
vagrantup-0.8.9 lib/vagrant/systems/debian.rb
vagrantup-0.8.8 lib/vagrant/systems/debian.rb
vagrantup-0.8.7 lib/vagrant/systems/debian.rb
vagrantup-0.8.6 lib/vagrant/systems/debian.rb
vagrantup-0.8.5 lib/vagrant/systems/debian.rb
vagrantup-0.8.4 lib/vagrant/systems/debian.rb
vagrantup-0.8.3 lib/vagrant/systems/debian.rb
vagrantup-0.8.2 lib/vagrant/systems/debian.rb
vagrantup-0.8.10 lib/vagrant/systems/debian.rb
vagrantup-0.8.1 lib/vagrant/systems/debian.rb
vagrantup-0.8.0 lib/vagrant/systems/debian.rb
vagrantup-0.7.8 lib/vagrant/systems/debian.rb
vagrantup-0.7.7 lib/vagrant/systems/debian.rb
vagrantup-0.7.6 lib/vagrant/systems/debian.rb
vagrantup-0.7.5 lib/vagrant/systems/debian.rb
vagrantup-0.7.4 lib/vagrant/systems/debian.rb
vagrantup-0.7.3 lib/vagrant/systems/debian.rb
vagrant-0.8.10 lib/vagrant/systems/debian.rb
vagrant-0.8.8 lib/vagrant/systems/debian.rb
vagrant-0.8.7 lib/vagrant/systems/debian.rb