Sha256: 40a0bf590b9862b8080d5863f8fbc141782f183b2d7ce1dc195f4e3f3af46226

Contents?: true

Size: 497 Bytes

Versions: 7

Compression:

Stored size: 497 Bytes

Contents

module VagrantPlugins
  module GuestFreeBSD
    module Cap
      class ChangeHostName
        def self.change_host_name(machine, name)
          if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'", {shell: "sh"})
            machine.communicate.sudo("sed -i '' 's/^hostname=.*$/hostname=#{name}/' /etc/rc.conf", {shell: "sh"})
            machine.communicate.sudo("hostname #{name}", {shell: "sh"})
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 4 versions & 3 rubygems

Version Path
vagrant-unbundled-1.8.1.2 plugins/guests/freebsd/cap/change_host_name.rb
vagrant-unbundled-1.8.1.1 plugins/guests/freebsd/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/plugins/guests/freebsd/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/guests/freebsd/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/guests/freebsd/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/guests/freebsd/cap/change_host_name.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/plugins/guests/freebsd/cap/change_host_name.rb