Make VM names symbols again, since they're accessed often.

This commit is contained in:
Mitchell Hashimoto 2011-12-03 19:33:44 -08:00
parent b61d9a6d3d
commit e2977e8948
2 changed files with 7 additions and 7 deletions

View File

@ -9,7 +9,7 @@ module Vagrant
# access to the VMs, CLI, etc. all in the scope of this environment. # access to the VMs, CLI, etc. all in the scope of this environment.
class Environment class Environment
HOME_SUBDIRS = ["tmp", "boxes", "logs"] HOME_SUBDIRS = ["tmp", "boxes", "logs"]
DEFAULT_VM = "default" DEFAULT_VM = :default
DEFAULT_HOME = "~/.vagrant.d" DEFAULT_HOME = "~/.vagrant.d"
# Parent environment (in the case of multi-VMs) # Parent environment (in the case of multi-VMs)
@ -452,7 +452,7 @@ module Vagrant
# Second pass, with the box # Second pass, with the box
config = inner_load[subvm, boxes.find(config.vm.box)] config = inner_load[subvm, boxes.find(config.vm.box)]
config.vm.name = vm_name.to_s config.vm.name = vm_name
# Return the final configuration for this VM # Return the final configuration for this VM
config config
@ -487,7 +487,7 @@ module Vagrant
vm = VirtualBox::VM.find(uuid) vm = VirtualBox::VM.find(uuid)
result[name.to_sym] = Vagrant::VM.new(name.to_sym, result[name.to_sym] = Vagrant::VM.new(name.to_sym,
self, self,
config.for_vm(name.to_s), config.for_vm(name.to_sym),
vm) vm)
end end

View File

@ -62,7 +62,7 @@ VF
end end
env = environment.create_vagrant_env env = environment.create_vagrant_env
env.config.for_vm("default").vm.name.should == "default" env.config.for_vm(:default).vm.name.should == :default
end end
it "should load VM configuration with multiple VMs" do it "should load VM configuration with multiple VMs" do
@ -81,8 +81,8 @@ VF
end end
env = environment.create_vagrant_env env = environment.create_vagrant_env
env.config.for_vm("foo").ssh.port.should == 100 env.config.for_vm(:foo).ssh.port.should == 100
env.config.for_vm("bar").ssh.port.should == 200 env.config.for_vm(:bar).ssh.port.should == 200
end end
it "should load box configuration" do it "should load box configuration" do
@ -101,7 +101,7 @@ VF
end end
env = environment.create_vagrant_env env = environment.create_vagrant_env
env.config.for_vm("default").ssh.port.should == 100 env.config.for_vm(:default).ssh.port.should == 100
end end
end end