Sha256: 1334962f3957960fa7bd75de375231b76d92619d4e1afa7075007919a3ae0146

Contents?: true

Size: 527 Bytes

Versions: 13

Compression:

Stored size: 527 Bytes

Contents

module VagrantPlugins
  module GuestArch
    module Cap
      class ChangeHostName
        def self.change_host_name(machine, name)
          machine.communicate.tap do |comm|
            # Only do this if the hostname is not already set
            if !comm.test("sudo hostname | grep '#{name}'")
              comm.sudo("hostnamectl set-hostname #{name}")
              comm.sudo("sed -i 's@^\\(127[.]0[.]0[.]1[[:space:]]\\+\\)@\\1#{name} @' /etc/hosts")
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 10 versions & 5 rubygems

Version Path
tamtam-vagrant-reload-1.1.3 vendor/cache/vagrant-0ac2a8738841/plugins/guests/arch/cap/change_host_name.rb
tamtam-vagrant-reload-1.1.2 vendor/cache/vagrant-0ac2a8738841/plugins/guests/arch/cap/change_host_name.rb
tamtam-vagrant-reload-1.1.1 vendor/cache/vagrant-0ac2a8738841/plugins/guests/arch/cap/change_host_name.rb
tamtam-vagrant-reload-1.1 vendor/cache/vagrant-0ac2a8738841/plugins/guests/arch/cap/change_host_name.rb
vagrant-unbundled-1.8.1.2 plugins/guests/arch/cap/change_host_name.rb
vagrant-unbundled-1.8.1.1 plugins/guests/arch/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/guests/arch/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/guests/arch/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/plugins/guests/arch/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/guests/arch/cap/change_host_name.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/plugins/guests/arch/cap/change_host_name.rb
tnargav-1.3.6 plugins/guests/arch/cap/change_host_name.rb
tnargav-1.3.3 plugins/guests/arch/cap/change_host_name.rb