Sha256: f0ff7dedd9d4fb2ed663742f08f1ff2920f17b16173f58054e2719a1603cafc7

Contents?: true

Size: 679 Bytes

Versions: 33

Compression:

Stored size: 679 Bytes

Contents

module VagrantPlugins
  module GuestCoreOS
    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("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

33 entries across 29 versions & 4 rubygems

Version Path
vagrant-unbundled-2.2.4.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.2.3.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.2.2.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.2.0.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.1.4.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.1.2.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/coreos/cap/change_host_name.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/coreos/cap/change_host_name.rb
vagrant-packet-0.1.2 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/coreos/cap/change_host_name.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/coreos/cap/change_host_name.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/coreos/cap/change_host_name.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/bundler/gems/vagrant-04f7215b5e3f/plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.1.1.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.0.4.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.0.3.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-aws-detiber-0.7.2.pre.4 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/guests/coreos/cap/change_host_name.rb
vagrant-aws-detiber-0.7.2.pre.3 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/guests/coreos/cap/change_host_name.rb
vagrant-aws-detiber-0.7.2.pre.2 vendor/bundle/ruby/2.3.0/bundler/gems/vagrant-419afb4dcffe/plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.0.2.0 plugins/guests/coreos/cap/change_host_name.rb
vagrant-unbundled-2.0.1.0 plugins/guests/coreos/cap/change_host_name.rb