Class: Vagrant::Systems::Ubuntu
- Defined in:
- lib/vagrant/systems/ubuntu.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Debian
#enable_host_only_network, #prepare_host_only_network
Methods inherited from Linux
#distro_dispatch, #halt, #mount_folder, #mount_nfs, #mount_shared_folder
Methods inherited from Base
#distro_dispatch, #enable_host_only_network, #halt, #initialize, #mount_nfs, #mount_shared_folder, #prepare_host_only_network
Constructor Details
This class inherits a constructor from Vagrant::Systems::Base
Instance Method Details
#change_host_name(name) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/vagrant/systems/ubuntu.rb', line 6 def change_host_name(name) vm.ssh.execute do |ssh| if !ssh.test?("sudo hostname | grep '#{name}'") ssh.exec!("sudo sed -i 's/.*$/#{name}/' /etc/hostname") ssh.exec!("sudo sed -i 's@^\\(127[.]0[.]1[.]1[[:space:]]\\+\\)@\\1#{name} #{name.split('.')[0]} @' /etc/hosts") ssh.exec!("sudo service hostname start") end end end |