Sha256: 0c991bac0bbb671925e585fca65145b53115bdc7e08ac4ea2ca5328150ba0389
Contents?: true
Size: 666 Bytes
Versions: 3
Compression:
Stored size: 666 Bytes
Contents
module VagrantPlugins module GuestSUSE module Cap class ChangeHostName def self.change_host_name(machine, name) comm = machine.communicate basename = name.split(".", 2)[0] if !comm.test('test "$(hostnamectl --static status)" = "#{basename}"', sudo: false) comm.sudo <<-EOH.gsub(/^ {14}/, '') hostnamectl set-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
3 entries across 3 versions & 1 rubygems