Sha256: f638e5f5c31e6b9463a84941c5b3d7487776251684669924a35f749ff021f6a3

Contents?: true

Size: 671 Bytes

Versions: 6

Compression:

Stored size: 671 Bytes

Contents

module VagrantPlugins
  module GuestCoreOS
    module Cap
      class ChangeHostName
        def self.change_host_name(machine, name)
          comm = machine.communicate

          if !comm.test("hostname --fqdn | grep -w '#{name}'")
            basename = name.split(".", 2)[0]
            comm.sudo("hostname '#{basename}'")

            # Note that when working with CoreOS, we explicitly do not add the
            # entry to /etc/hosts because this file does not exist on CoreOS.
            # We could create it, but the recommended approach on CoreOS is to
            # use Fleet to manage /etc/hosts files.
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/guests/coreos/cap/change_host_name.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/guests/coreos/cap/change_host_name.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/guests/coreos/cap/change_host_name.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-1.8.4.2 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-1.8.4.1 plugins/guests/coreos/cap/change_host_name.rb