Sha256: eee7db0a2895514686e5a3ee40a10f718b42a64d91f915309df9d62e8fd66c9d
Contents?: true
Size: 662 Bytes
Versions: 6
Compression:
Stored size: 662 Bytes
Contents
module VagrantPlugins module GuestDebian module Cap class ChangeHostName def self.change_host_name(machine, name) machine.communicate.tap do |comm| if !comm.test("hostname --fqdn | grep '^#{name}$' || hostname --short | grep '^#{name}$'") comm.sudo("sed -r -i 's/^(127[.]0[.]1[.]1[[:space:]]+).*$/\\1#{name} #{name.split('.')[0]}/' /etc/hosts") comm.sudo("sed -i 's/.*$/#{name.split('.')[0]}/' /etc/hostname") comm.sudo("hostname -F /etc/hostname") comm.sudo("hostname --fqdn > /etc/mailname") end end end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems