Sha256: 7e261407e8dbdbb853f66540819e5f65659d100ba648bf2b87f49c111680fd0b

Contents?: true

Size: 736 Bytes

Versions: 1

Compression:

Stored size: 736 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}")
            # LocalHostName shouldn't contain dots.
            # It is used by Bonjour and visible through file sharing services.
            machine.communicate.sudo("scutil --set LocalHostName #{name.gsub(/\.+/, '')}")
            machine.communicate.sudo("hostname #{name}")
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/bundler/gems/vagrant-c84e05fd063f/plugins/guests/darwin/cap/change_host_name.rb