Sha256: 305c12c87495714514a4c9674cfa9eaf33d02b259136047c229d2ed4aa22e7cd

Contents?: true

Size: 786 Bytes

Versions: 1

Compression:

Stored size: 786 Bytes

Contents

require 'vagrant'
require 'vagrant-hosts/provisioner'

module VagrantHosts
class Provisioner
module Hostname
  # Abstract the details of setting a guest hostname on different versions of
  # Vagrant.
  #
  # Vagrant commit 61d2f9f96fc0f0ef5869c732674f25c4ccc85c8c converts the
  # #change_host_name # method to a capability, which breaks the API between
  # 1.1 and 1.2. :(

  # @param name [String] The new hostname to apply on the guest
  def change_host_name(name)
    case Vagrant::VERSION
    when /1\.1/
      @machine.guest.change_host_name(name)
    when /1\.2/
      @machine.guest.capability(:change_host_name, name)
    else
      raise RuntimeError, "#{Vagrant::VERSION} isn't a recognized Vagrant version, can't reliably shim `change_host_name`"
    end
  end

end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-hosts-1.1.1 lib/vagrant-hosts/provisioner/hostname.rb