Sha256: 658471d5e2bab1def9c1f913374f692b50de19c1a7409fb65766f1ee2f97583b
Contents?: true
Size: 678 Bytes
Versions: 20
Compression:
Stored size: 678 Bytes
Contents
module VagrantPlugins module GuestSUSE module Cap class ChangeHostName def self.change_host_name(machine, name) comm = machine.communicate if !comm.test("hostname -f | grep '^#{name}$'", sudo: false) basename = name.split(".", 2)[0] comm.sudo <<-EOH.gsub(/^ {14}/, '') echo '#{basename}' > /etc/HOSTNAME hostname '#{basename}' # Prepend ourselves to /etc/hosts grep -w '#{name}' /etc/hosts || { sed -i'' '1i 127.0.0.1\\t#{name}\\t#{basename}' /etc/hosts } EOH end end end end end end
Version data entries
20 entries across 16 versions & 3 rubygems