config.vm.guest now forces guest setting again [GH-1800]
This commit is contained in:
parent
2209204cf2
commit
80f06605fb
|
@ -30,6 +30,7 @@ BUG FIXES:
|
|||
- Finding V1 boxes now works properly again to avoid "box not found"
|
||||
errors. [GH-1691]
|
||||
- Setting hostname on SLES 11 works again. [GH-1781]
|
||||
- `config.vm.guest` properly forces guests again. [GH-1800]
|
||||
|
||||
## 1.2.2 (April 23, 2013)
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@ Vagrant.configure("2") do |config|
|
|||
config.vm.base_mac = nil
|
||||
config.vm.graceful_halt_retry_count = 60
|
||||
config.vm.graceful_halt_retry_interval = 1
|
||||
config.vm.guest = :linux
|
||||
|
||||
# Share SSH locally by default
|
||||
config.vm.network :forwarded_port,
|
||||
|
|
|
@ -69,7 +69,16 @@ module Vagrant
|
|||
guest_info = @guests[name]
|
||||
guest = guest_info[0].new
|
||||
|
||||
if guest.detect?(@machine)
|
||||
# If a specific guest was specified, then attempt to use that
|
||||
# guest no matter what. Otherwise, only use it if it was detected.
|
||||
use_this_guest = false
|
||||
if @machine.config.vm.guest.nil?
|
||||
use_this_guest = guest.detect?(@machine)
|
||||
else
|
||||
use_this_guest = @machine.config.vm.guest.to_sym == name.to_sym
|
||||
end
|
||||
|
||||
if use_this_guest
|
||||
@logger.info("Detected: #{name}!")
|
||||
@chain << [name, guest]
|
||||
@name = name
|
||||
|
|
|
@ -26,6 +26,7 @@ module VagrantPlugins
|
|||
def initialize
|
||||
@graceful_halt_retry_count = UNSET_VALUE
|
||||
@graceful_halt_retry_interval = UNSET_VALUE
|
||||
@guest = UNSET_VALUE
|
||||
@hostname = UNSET_VALUE
|
||||
@provisioners = []
|
||||
|
||||
|
@ -225,8 +226,12 @@ module VagrantPlugins
|
|||
|
||||
def finalize!
|
||||
# Defaults
|
||||
@guest = nil if @guest == UNSET_VALUE
|
||||
@hostname = nil if @hostname == UNSET_VALUE
|
||||
|
||||
# Set the guest properly
|
||||
@guest = @guest.to_sym if @guest
|
||||
|
||||
# If we haven't defined a single VM, then we need to define a
|
||||
# default VM which just inherits the rest of the configuration.
|
||||
define(DEFAULT_VM_NAME) if defined_vm_keys.empty?
|
||||
|
|
|
@ -10,6 +10,9 @@ describe Vagrant::Guest do
|
|||
let(:machine) do
|
||||
double("machine").tap do |m|
|
||||
m.stub(:inspect => "machine")
|
||||
m.stub(:config => double("config"))
|
||||
m.config.stub(:vm => double("vm_config"))
|
||||
m.config.vm.stub(:guest => nil)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -143,6 +146,16 @@ describe Vagrant::Guest do
|
|||
subject.chain.map { |x| x[1] }.map(&:name).should == [:baz, :bar, :foo]
|
||||
end
|
||||
|
||||
it "detects the forced guest setting" do
|
||||
register_guest(:foo, nil, false)
|
||||
register_guest(:bar, nil, false)
|
||||
|
||||
machine.config.vm.stub(:guest => :bar)
|
||||
|
||||
subject.detect!
|
||||
subject.name.should == :bar
|
||||
end
|
||||
|
||||
it "raises an exception if no guest can be detected" do
|
||||
expect { subject.detect! }.
|
||||
to raise_error(Vagrant::Errors::GuestNotDetected)
|
||||
|
|
Loading…
Reference in New Issue