Sha256: c1d1cdee9423084ba202be2d1047ee3dd5707fdc93b76a0e315e968e7f1e2d55

Contents?: true

Size: 571 Bytes

Versions: 3

Compression:

Stored size: 571 Bytes

Contents

module VagrantPlugins
  module GuestDarwin
    module Cap
      class ChangeHostName
        def self.change_host_name(machine, name)
          if !machine.communicate.test("hostname -f | grep '^#{name}$' || hostname -s | grep '^#{name}$'")
            machine.communicate.sudo("scutil --set ComputerName #{name}")
            machine.communicate.sudo("scutil --set HostName #{name}")
            machine.communicate.sudo("scutil --set LocalHostName #{name}")
            machine.communicate.sudo("hostname #{name}")
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 1 versions & 1 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/plugins/guests/darwin/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/plugins/guests/darwin/cap/change_host_name.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/plugins/guests/darwin/cap/change_host_name.rb