vagrant 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. data/.gitignore +3 -1
  2. data/CHANGELOG.md +16 -1
  3. data/lib/vagrant/action.rb +1 -1
  4. data/lib/vagrant/action/box/download.rb +1 -1
  5. data/lib/vagrant/action/box/unpackage.rb +1 -1
  6. data/lib/vagrant/action/box/verify.rb +1 -1
  7. data/lib/vagrant/action/builder.rb +1 -1
  8. data/lib/vagrant/action/general/package.rb +10 -4
  9. data/lib/vagrant/action/vm/boot.rb +1 -1
  10. data/lib/vagrant/action/vm/check_box.rb +2 -2
  11. data/lib/vagrant/action/vm/export.rb +1 -1
  12. data/lib/vagrant/action/vm/forward_ports.rb +8 -8
  13. data/lib/vagrant/action/vm/import.rb +1 -1
  14. data/lib/vagrant/action/vm/network.rb +6 -2
  15. data/lib/vagrant/action/vm/nfs.rb +3 -3
  16. data/lib/vagrant/action/vm/provision.rb +4 -3
  17. data/lib/vagrant/action/warden.rb +5 -4
  18. data/lib/vagrant/box.rb +1 -1
  19. data/lib/vagrant/command/box.rb +2 -2
  20. data/lib/vagrant/command/helpers.rb +5 -5
  21. data/lib/vagrant/command/package.rb +3 -3
  22. data/lib/vagrant/command/ssh.rb +3 -3
  23. data/lib/vagrant/command/ssh_config.rb +2 -2
  24. data/lib/vagrant/config.rb +2 -2
  25. data/lib/vagrant/config/vm.rb +7 -0
  26. data/lib/vagrant/downloaders/file.rb +1 -1
  27. data/lib/vagrant/downloaders/http.rb +1 -1
  28. data/lib/vagrant/environment.rb +21 -5
  29. data/lib/vagrant/errors.rb +16 -0
  30. data/lib/vagrant/hosts/bsd.rb +1 -1
  31. data/lib/vagrant/provisioners/chef.rb +2 -2
  32. data/lib/vagrant/provisioners/chef_server.rb +3 -3
  33. data/lib/vagrant/provisioners/puppet.rb +85 -0
  34. data/lib/vagrant/ssh.rb +23 -21
  35. data/lib/vagrant/systems/linux.rb +1 -1
  36. data/lib/vagrant/systems/solaris.rb +7 -4
  37. data/lib/vagrant/util/hash_with_indifferent_access.rb +1 -1
  38. data/lib/vagrant/util/platform.rb +18 -1
  39. data/lib/vagrant/version.rb +1 -1
  40. data/lib/vagrant/vm.rb +4 -4
  41. data/templates/locales/en.yml +34 -4
  42. data/test/vagrant/action/general/package_test.rb +14 -0
  43. data/test/vagrant/action/vm/network_test.rb +18 -0
  44. data/test/vagrant/action/vm/provision_test.rb +4 -0
  45. data/test/vagrant/command/helpers_test.rb +2 -2
  46. data/test/vagrant/config/vm_test.rb +8 -0
  47. data/test/vagrant/provisioners/puppet_test.rb +135 -0
  48. data/test/vagrant/ssh_test.rb +18 -10
  49. data/test/vagrant/vm_test.rb +2 -1
  50. metadata +6 -5
  51. data/Gemfile.lock +0 -76
data/.gitignore CHANGED
@@ -8,4 +8,6 @@ _site/*
8
8
  !templates/*
9
9
  *.org
10
10
  .yardoc/
11
- doc/
11
+ doc/
12
+ tags
13
+ Gemfile.lock
@@ -1,4 +1,19 @@
1
- ## 0.6.8 (unreleased)
1
+ ## 0.6.9 (December 21, 2010)
2
+
3
+ - Puppet provisioner. [GH-223]
4
+ - Solaris system configurable to use `sudo`.
5
+ - Solaris system registered, so it can be set with `:solaris`.
6
+ - `vagrant package` include can be a directory name, which will cause the
7
+ contents to be recursively copied into the package. [GH-241]
8
+ - Arbitrary options to puppet binary can be set with `config.puppet.options`. [GH-242]
9
+ - BSD hosts use proper GNU sed syntax for clearing NFS shares. [GH-243]
10
+ - Enumerate VMs in a multi-VM environment in order they were defined. [GH-244]
11
+ - Check for VM boot changed to use `timeout` library, which works better with Windows.
12
+ - Show special error if VirtualBox not detected on 64-bit Windows.
13
+ - Show error to Windows users attempting to use host only networking since
14
+ it doesn't work yet.
15
+
16
+ ## 0.6.8 (November 30, 2010)
2
17
 
3
18
  - Network interfaces are now up/down in distinct commands instead of just
4
19
  restarting "networking." [GH-192]
@@ -94,7 +94,7 @@ module Vagrant
94
94
  callable = callable_id
95
95
  callable = Builder.new.use(callable_id) if callable_id.kind_of?(Class)
96
96
  callable = self.class.actions[callable_id] if callable_id.kind_of?(Symbol)
97
- raise ArgumentError.new("Argument to run must be a callable object or registered action.") if !callable || !callable.respond_to?(:call)
97
+ raise ArgumentError, "Argument to run must be a callable object or registered action." if !callable || !callable.respond_to?(:call)
98
98
 
99
99
  action_environment = Action::Environment.new(env)
100
100
  action_environment.merge!(options || {})
@@ -33,7 +33,7 @@ module Vagrant
33
33
  end
34
34
  end
35
35
 
36
- raise Errors::BoxDownloadUnknownType.new if !@downloader
36
+ raise Errors::BoxDownloadUnknownType if !@downloader
37
37
 
38
38
  @downloader.prepare(@env["box"].uri)
39
39
  true
@@ -37,7 +37,7 @@ module Vagrant
37
37
  end
38
38
 
39
39
  def setup_box_directory
40
- raise Errors::BoxAlreadyExists.new(:name => @env["box"].name) if File.directory?(@env["box"].directory)
40
+ raise Errors::BoxAlreadyExists, :name => @env["box"].name if File.directory?(@env["box"].directory)
41
41
 
42
42
  FileUtils.mkdir_p(@env["box"].directory)
43
43
  @box_directory = @env["box"].directory
@@ -12,7 +12,7 @@ module Vagrant
12
12
  env.ui.info I18n.t("vagrant.actions.box.verify.verifying")
13
13
  VirtualBox::Appliance.new(env["box"].ovf_file.to_s)
14
14
  rescue Exception
15
- raise Errors::BoxVerificationFailed.new
15
+ raise Errors::BoxVerificationFailed
16
16
  end
17
17
 
18
18
  @app.call(env)
@@ -24,7 +24,7 @@ module Vagrant
24
24
  end
25
25
 
26
26
  # Returns the current stack of middlewares. You probably won't
27
- # need to use this directly, and its recommended that you don't.
27
+ # need to use this directly, and it's recommended that you don't.
28
28
  #
29
29
  # @return [Array]
30
30
  def stack
@@ -28,8 +28,8 @@ module Vagrant
28
28
  def call(env)
29
29
  @env = env
30
30
 
31
- raise Errors::PackageOutputExists.new if File.exist?(tar_path)
32
- raise Errors::PackageRequiresDirectory.new if !@env["package.directory"] || !File.directory?(@env["package.directory"])
31
+ raise Errors::PackageOutputExists if File.exist?(tar_path)
32
+ raise Errors::PackageRequiresDirectory if !@env["package.directory"] || !File.directory?(@env["package.directory"])
33
33
 
34
34
  verify_files_to_copy
35
35
  compress
@@ -57,7 +57,7 @@ module Vagrant
57
57
 
58
58
  def verify_files_to_copy
59
59
  files_to_copy.each do |file, _|
60
- raise Errors::PackageIncludeMissing.new(:file => file) if !File.exist?(file)
60
+ raise Errors::PackageIncludeMissing, :file => file if !File.exist?(file)
61
61
  end
62
62
  end
63
63
 
@@ -68,7 +68,13 @@ module Vagrant
68
68
  files_to_copy.each do |from, to|
69
69
  @env.ui.info I18n.t("vagrant.actions.general.package.packaging", :file => from)
70
70
  FileUtils.mkdir_p(to.parent)
71
- FileUtils.cp(from, to)
71
+
72
+ # Copy direcotry contents recursively.
73
+ if File.directory?(from)
74
+ FileUtils.cp_r(Dir.glob(from), to.parent)
75
+ else
76
+ FileUtils.cp(from, to)
77
+ end
72
78
  end
73
79
  end
74
80
 
@@ -12,7 +12,7 @@ module Vagrant
12
12
 
13
13
  # Start up the VM and wait for it to boot.
14
14
  boot
15
- raise Errors::VMFailedToBoot.new if !wait_for_boot
15
+ raise Errors::VMFailedToBoot if !wait_for_boot
16
16
  @app.call(env)
17
17
  end
18
18
 
@@ -8,11 +8,11 @@ module Vagrant
8
8
 
9
9
  def call(env)
10
10
  box_name = env["config"].vm.box
11
- raise Errors::BoxNotSpecified.new if !box_name
11
+ raise Errors::BoxNotSpecified if !box_name
12
12
 
13
13
  if !env.env.boxes.find(box_name)
14
14
  box_url = env["config"].vm.box_url
15
- raise Errors::BoxSpecifiedDoesntExist.new(:name => box_name) if !box_url
15
+ raise Errors::BoxSpecifiedDoesntExist, :name => box_name if !box_url
16
16
 
17
17
  env.ui.info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name)
18
18
  Vagrant::Box.add(env.env, box_name, box_url)
@@ -14,7 +14,7 @@ module Vagrant
14
14
  def call(env)
15
15
  @env = env
16
16
 
17
- raise Errors::VMPowerOffToPackage.new if !@env["vm"].vm.powered_off?
17
+ raise Errors::VMPowerOffToPackage if !@env["vm"].vm.powered_off?
18
18
 
19
19
  setup_temp_dir
20
20
  export
@@ -23,7 +23,7 @@ module Vagrant
23
23
  # 1024, which causes the forwarded ports to fail.
24
24
  def threshold_check
25
25
  @env.env.config.vm.forwarded_ports.each do |name, options|
26
- raise Errors::ForwardPortBelowThreshold.new if options[:hostport] <= 1024
26
+ raise Errors::ForwardPortBelowThreshold if options[:hostport] <= 1024
27
27
  end
28
28
  end
29
29
 
@@ -47,9 +47,9 @@ module Vagrant
47
47
  if !options[:auto]
48
48
  # Auto fixing is disabled for this port forward, so we
49
49
  # must throw an error so the user can fix it.
50
- raise Errors::ForwardPortCollision.new(:name => name,
51
- :host_port => options[:hostport].to_s,
52
- :guest_port => options[:guestport].to_s)
50
+ raise Errors::ForwardPortCollision, :name => name,
51
+ :host_port => options[:hostport].to_s,
52
+ :guest_port => options[:guestport].to_s
53
53
  end
54
54
 
55
55
  # Get the auto port range and get rid of the used ports and
@@ -60,10 +60,10 @@ module Vagrant
60
60
  range -= existing_ports
61
61
 
62
62
  if range.empty?
63
- raise Errors::ForwardPortAutolistEmpty.new(:vm_name => @env["vm"].name,
64
- :name => name,
65
- :host_port => options[:hostport].to_s,
66
- :guest_port => options[:guestport].to_s)
63
+ raise Errors::ForwardPortAutolistEmpty, :vm_name => @env["vm"].name,
64
+ :name => name,
65
+ :host_port => options[:hostport].to_s,
66
+ :guest_port => options[:guestport].to_s
67
67
  end
68
68
 
69
69
  # Set the port up to be the first one and add that port to
@@ -15,7 +15,7 @@ module Vagrant
15
15
  end
16
16
 
17
17
  # Flag as erroneous and return if import failed
18
- raise Errors::VMImportFailure.new if !env["vm"].vm
18
+ raise Errors::VMImportFailure if !env["vm"].vm
19
19
 
20
20
  # Import completed successfully. Continue the chain
21
21
  @app.call(env)
@@ -8,8 +8,12 @@ module Vagrant
8
8
  @app = app
9
9
  @env = env
10
10
 
11
+ if enable_network? && Util::Platform.windows?
12
+ raise Errors::NetworkNotImplemented
13
+ end
14
+
11
15
  env["config"].vm.network_options.compact.each do |network_options|
12
- raise Errors::NetworkCollision.new if !verify_no_bridge_collision(network_options)
16
+ raise Errors::NetworkCollision if !verify_no_bridge_collision(network_options)
13
17
  end
14
18
  end
15
19
 
@@ -83,7 +87,7 @@ module Vagrant
83
87
  end
84
88
  end
85
89
 
86
- raise Errors::NetworkNotFound.new(:name => net_options[:name]) if net_options[:name]
90
+ raise Errors::NetworkNotFound, :name => net_options[:name] if net_options[:name]
87
91
 
88
92
  # One doesn't exist, create it.
89
93
  @env.ui.info I18n.t("vagrant.actions.vm.network.creating")
@@ -147,9 +147,9 @@ module Vagrant
147
147
 
148
148
  # Verifies that the host is set and supports NFS.
149
149
  def verify_settings
150
- raise Errors::NFSHostRequired.new if @env["host"].nil?
151
- raise Errors::NFSNotSupported.new if !@env["host"].nfs?
152
- raise Errors::NFSNoHostNetwork.new if @env["config"].vm.network_options.empty?
150
+ raise Errors::NFSHostRequired if @env["host"].nil?
151
+ raise Errors::NFSNotSupported if !@env["host"].nfs?
152
+ raise Errors::NFSNoHostNetwork if @env["config"].vm.network_options.empty?
153
153
  end
154
154
  end
155
155
  end
@@ -28,16 +28,17 @@ module Vagrant
28
28
 
29
29
  if provisioner.is_a?(Class)
30
30
  @provisioner = provisioner.new(@env)
31
- raise Errors::ProvisionInvalidClass.new if !@provisioner.is_a?(Provisioners::Base)
31
+ raise Errors::ProvisionInvalidClass if !@provisioner.is_a?(Provisioners::Base)
32
32
  elsif provisioner.is_a?(Symbol)
33
33
  # We have a few hard coded provisioners for built-ins
34
34
  mapping = {
35
35
  :chef_solo => Provisioners::ChefSolo,
36
- :chef_server => Provisioners::ChefServer
36
+ :chef_server => Provisioners::ChefServer,
37
+ :puppet => Provisioners::Puppet
37
38
  }
38
39
 
39
40
  provisioner_klass = mapping[provisioner]
40
- raise Errors::ProvisionUnknownType.new(:provisioner => provisioner.to_s) if provisioner_klass.nil?
41
+ raise Errors::ProvisionUnknownType, :provisioner => provisioner.to_s if provisioner_klass.nil?
41
42
  @provisioner = provisioner_klass.new(@env)
42
43
  end
43
44
 
@@ -7,8 +7,9 @@ module Vagrant
7
7
  # exceptional events, and by providing a simple callback, can clean up
8
8
  # in any erroneous case.
9
9
  #
10
- # Except for those who are curious about the internal workings of Vagrant,
11
- # Warden will "just work" behind the scenes.
10
+ # Warden will "just work" behind the scenes, and is not of particular
11
+ # interest except to those who are curious about the internal workings
12
+ # of Vagrant.
12
13
  class Warden
13
14
  attr_accessor :actions, :stack
14
15
 
@@ -23,9 +24,9 @@ module Vagrant
23
24
  begin
24
25
  # Call the next middleware in the sequence, appending to the stack
25
26
  # of "recoverable" middlewares in case something goes wrong!
26
- raise Errors::VagrantInterrupt.new if env.interrupted?
27
+ raise Errors::VagrantInterrupt if env.interrupted?
27
28
  @stack.unshift(@actions.shift).first.call(env)
28
- raise Errors::VagrantInterrupt.new if env.interrupted?
29
+ raise Errors::VagrantInterrupt if env.interrupted?
29
30
  rescue SystemExit
30
31
  # This means that an "exit" or "abort" was called. In these cases,
31
32
  # we just exit immediately.
@@ -57,7 +57,7 @@ module Vagrant
57
57
  # method requires that `name` and `uri` be set. The logic of this method
58
58
  # is kicked out to the `box_add` registered middleware.
59
59
  def add
60
- raise Errors::BoxAlreadyExists.new(:name => name) if File.directory?(directory)
60
+ raise Errors::BoxAlreadyExists, :name => name if File.directory?(directory)
61
61
  env.actions.run(:box_add, { "box" => self, "validate" => false })
62
62
  end
63
63
 
@@ -11,14 +11,14 @@ module Vagrant
11
11
  desc "remove NAME", "Remove a box from the system"
12
12
  def remove(name)
13
13
  b = env.boxes.find(name)
14
- raise Errors::BoxNotFound.new(:name => name) if !b
14
+ raise Errors::BoxNotFound, :name => name if !b
15
15
  b.destroy
16
16
  end
17
17
 
18
18
  desc "repackage NAME", "Repackage an installed box into a `.box` file."
19
19
  def repackage(name)
20
20
  b = env.boxes.find(name)
21
- raise Errors::BoxNotFound.new(:name => name) if !b
21
+ raise Errors::BoxNotFound, :name => name if !b
22
22
  b.repackage
23
23
  end
24
24
 
@@ -4,24 +4,24 @@ module Vagrant
4
4
  # Initializes the environment by pulling the environment out of
5
5
  # the configuration hash and sets up the UI if necessary.
6
6
  def initialize_environment(args, options, config)
7
- raise Errors::CLIMissingEnvironment.new if !config[:env]
7
+ raise Errors::CLIMissingEnvironment if !config[:env]
8
8
  @env = config[:env]
9
9
  end
10
10
 
11
11
  # This returns an array of {VM} objects depending on the arguments
12
12
  # given to the command.
13
13
  def target_vms(name=nil)
14
- raise Errors::NoEnvironmentError.new if !env.root_path
14
+ raise Errors::NoEnvironmentError if !env.root_path
15
15
 
16
16
  name ||= self.name rescue nil
17
17
 
18
18
  @target_vms ||= begin
19
19
  if env.multivm?
20
- return env.vms.values if !name
20
+ return env.vms_ordered if !name
21
21
  vm = env.vms[name.to_sym]
22
- raise Errors::VMNotFoundError.new(:name => name) if !vm
22
+ raise Errors::VMNotFoundError, :name => name if !vm
23
23
  else
24
- raise Errors::MultiVMEnvironmentRequired.new if name
24
+ raise Errors::MultiVMEnvironmentRequired if name
25
25
  vm = env.vms.values.first
26
26
  end
27
27
 
@@ -16,14 +16,14 @@ module Vagrant
16
16
 
17
17
  def package_base
18
18
  vm = VM.find(options[:base], env)
19
- raise Errors::BaseVMNotFound.new(:name => options[:base]) if !vm.created?
19
+ raise Errors::BaseVMNotFound, :name => options[:base] if !vm.created?
20
20
  package_vm(vm)
21
21
  end
22
22
 
23
23
  def package_target
24
- raise Errors::MultiVMTargetRequired.new(:command => "package") if target_vms.length > 1
24
+ raise Errors::MultiVMTargetRequired, :command => "package" if target_vms.length > 1
25
25
  vm = target_vms.first
26
- raise Errors::VMNotCreatedError.new if !vm.created?
26
+ raise Errors::VMNotCreatedError if !vm.created?
27
27
  package_vm(vm)
28
28
  end
29
29
 
@@ -24,15 +24,15 @@ module Vagrant
24
24
  end
25
25
 
26
26
  def ssh_connect
27
- raise Errors::VMNotCreatedError.new if !ssh_vm.created?
28
- raise Errors::VMNotRunningError.new if !ssh_vm.vm.running?
27
+ raise Errors::VMNotCreatedError if !ssh_vm.created?
28
+ raise Errors::VMNotRunningError if !ssh_vm.vm.running?
29
29
  ssh_vm.ssh.connect
30
30
  end
31
31
 
32
32
  def ssh_vm
33
33
  @ssh_vm ||= begin
34
34
  vm = self.name.nil? && env.multivm? ? env.primary_vm : nil
35
- raise Errors::MultiVMTargetRequired.new(:command => "ssh") if !vm && target_vms.length > 1
35
+ raise Errors::MultiVMTargetRequired, :command => "ssh" if !vm && target_vms.length > 1
36
36
  vm = target_vms.first if !vm
37
37
  vm
38
38
  end
@@ -5,9 +5,9 @@ module Vagrant
5
5
  register "ssh_config", "outputs .ssh/config valid syntax for connecting to this environment via ssh"
6
6
 
7
7
  def execute
8
- raise Errors::MultiVMTargetRequired.new(:command => "ssh_config") if target_vms.length > 1
8
+ raise Errors::MultiVMTargetRequired, :command => "ssh_config" if target_vms.length > 1
9
9
  vm = target_vms.first
10
- raise Errors::VMNotCreatedError.new if !vm.created?
10
+ raise Errors::VMNotCreatedError if !vm.created?
11
11
 
12
12
  $stdout.puts(Util::TemplateRenderer.render("ssh_config", {
13
13
  :host_key => options[:host] || "vagrant",
@@ -95,7 +95,7 @@ module Vagrant
95
95
  load item
96
96
  rescue SyntaxError => e
97
97
  # Report syntax errors in a nice way for Vagrantfiles
98
- raise Errors::VagrantfileSyntaxError.new(:file => e.message)
98
+ raise Errors::VagrantfileSyntaxError, :file => e.message
99
99
  end
100
100
  elsif item.is_a?(Proc)
101
101
  self.class.run(&item)
@@ -159,7 +159,7 @@ module Vagrant
159
159
  end
160
160
 
161
161
  return if errors.empty?
162
- raise Errors::ConfigValidationFailed.new(:messages => Util::TemplateRenderer.render("config/validation_failed", :errors => errors))
162
+ raise Errors::ConfigValidationFailed, :messages => Util::TemplateRenderer.render("config/validation_failed", :errors => errors)
163
163
  end
164
164
  end
165
165
  end
@@ -88,8 +88,15 @@ module Vagrant
88
88
  @defined_vms ||= {}
89
89
  end
90
90
 
91
+ # This returns the keys of the sub-vms in the order they were
92
+ # defined.
93
+ def defined_vm_keys
94
+ @defined_vm_keys ||= []
95
+ end
96
+
91
97
  def define(name, options=nil, &block)
92
98
  options ||= {}
99
+ defined_vm_keys << name
93
100
  defined_vms[name.to_sym] ||= SubVM.new
94
101
  defined_vms[name.to_sym].options.merge!(options)
95
102
  defined_vms[name.to_sym].push_proc(&block)
@@ -10,7 +10,7 @@ module Vagrant
10
10
  end
11
11
 
12
12
  def prepare(source_url)
13
- raise Errors::DownloaderFileDoesntExist.new if !::File.file?(source_url)
13
+ raise Errors::DownloaderFileDoesntExist if !::File.file?(source_url)
14
14
  end
15
15
 
16
16
  def download!(source_url, destination_file)
@@ -48,7 +48,7 @@ module Vagrant
48
48
  end
49
49
  end
50
50
  rescue SocketError
51
- raise Errors::DownloaderHTTPSocketError.new
51
+ raise Errors::DownloaderHTTPSocketError
52
52
  end
53
53
  end
54
54
  end
@@ -31,9 +31,17 @@ module Vagrant
31
31
  # VirtualBox installed is high enough.
32
32
  def check_virtualbox!
33
33
  version = VirtualBox.version
34
- raise Errors::VirtualBoxNotDetected.new if version.nil?
35
- raise Errors::VirtualBoxInvalidVersion.new(:version => version.to_s) if version.to_f < 3.2
36
- raise Errors::VirtualBoxInvalidOSE.new(:version => version.to_s) if version.to_s.downcase.include?("ose")
34
+ raise Errors::VirtualBoxNotDetected if version.nil?
35
+ raise Errors::VirtualBoxInvalidVersion, :version => version.to_s if version.to_f < 3.2
36
+ raise Errors::VirtualBoxInvalidOSE, :version => version.to_s if version.to_s.downcase.include?("ose")
37
+ rescue Errors::VirtualBoxNotDetected
38
+ # On 64-bit Windows, show a special error. This error is a subclass
39
+ # of VirtualBoxNotDetected, so libraries which use Vagrant can just
40
+ # rescue VirtualBoxNotDetected.
41
+ raise Errors::VirtualBoxNotDetected_Win64 if Util::Platform.windows? && Util::Platform.bit64?
42
+
43
+ # Otherwise, reraise the old error
44
+ raise
37
45
  end
38
46
  end
39
47
 
@@ -126,13 +134,21 @@ module Vagrant
126
134
 
127
135
  # Returns the VMs associated with this environment.
128
136
  #
129
- # @return [Array<VM>]
137
+ # @return [Hash<Symbol,VM>]
130
138
  def vms
131
139
  return parent.vms if parent
132
140
  load! if !loaded?
133
141
  @vms ||= load_vms!
134
142
  end
135
143
 
144
+ # Returns the VMs associated with this environment, in the order
145
+ # that they were defined.
146
+ #
147
+ # @return [Array<VM>]
148
+ def vms_ordered
149
+ @vms_enum ||= config.vm.defined_vm_keys.map {|name| @vms[name]}
150
+ end
151
+
136
152
  # Returns the primary VM associated with this environment. This
137
153
  # method is only applicable for multi-VM environments. This can
138
154
  # potentially be nil if no primary VM is specified.
@@ -352,7 +368,7 @@ module Vagrant
352
368
 
353
369
  # For any VMs which aren't created, create a blank VM instance for
354
370
  # them
355
- all_keys = config.vm.defined_vms.keys
371
+ all_keys = config.vm.defined_vm_keys
356
372
  all_keys = [DEFAULT_VM] if all_keys.empty?
357
373
  all_keys.each do |name|
358
374
  result[name] = Vagrant::VM.new(:name => name, :env => self) if !result.has_key?(name)