Class: VagrantPlugins::GuestOpenWrt::Cap::ChangeHostName

Inherits:
Object
  • Object
show all
Defined in:
lib/openwrt/vagrant/cap/change_host_name.rb

Class Method Summary collapse

Class Method Details

.change_host_name(machine, name) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/openwrt/vagrant/cap/change_host_name.rb', line 5

def self.change_host_name(machine, name)
  begin
    machine.communicate.execute("sudo uci set system.@system[0].hostname=\"#{name}\"")
    machine.communicate.execute("sudo uci commit")
  rescue IOError
    # Ignore, this probably means connection closed because it
    # shut down.
  end
end