core: pass environment into all host caps

This commit is contained in:
Mitchell Hashimoto 2014-01-07 20:34:33 -08:00
parent 5e490e3746
commit 09a425030b
3 changed files with 8 additions and 6 deletions

View File

@ -498,7 +498,8 @@ module Vagrant
@host = Host.new(
host_klass,
Vagrant.plugin("2").manager.hosts,
Vagrant.plugin("2").manager.host_capabilities)
Vagrant.plugin("2").manager.host_capabilities,
self)
rescue Errors::CapabilityHostNotDetected
# If the auto-detect failed, then we create a brand new host
# with no capabilities and use that. This should almost never happen
@ -510,7 +511,7 @@ module Vagrant
hosts = { generic: [klass, nil] }
host_caps = {}
@host = Host.new(:generic, hosts, host_caps)
@host = Host.new(:generic, hosts, host_caps, self)
rescue Errors::CapabilityHostExplicitNotDetected => e
raise Errors::HostExplicitNotDetected, e.extra_data
end

View File

@ -9,8 +9,8 @@ module Vagrant
class Host
include CapabilityHost
def initialize(host, hosts, capabilities)
initialize_capabilities!(host, hosts, capabilities)
def initialize(host, hosts, capabilities, env)
initialize_capabilities!(host, hosts, capabilities, env)
end
end
end

View File

@ -7,11 +7,12 @@ describe Vagrant::Host do
let(:capabilities) { {} }
let(:hosts) { {} }
let(:env) { Object.new }
it "initializes the capabilities" do
described_class.any_instance.should_receive(:initialize_capabilities!).
with(:foo, hosts, capabilities)
with(:foo, hosts, capabilities, env)
described_class.new(:foo, hosts, capabilities)
described_class.new(:foo, hosts, capabilities, env)
end
end