From afab61a05f873756a8a79b7fefdd50829ddf10ef Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 6 Sep 2013 00:10:23 -0700 Subject: [PATCH] core: don't use active_machines too much, deletes data --- CHANGELOG.md | 2 ++ lib/vagrant/plugin/v2/command.rb | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7058e74c..99d4fd0af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ BUG FIXES: Vagrantfile can cause errors. - core: `VAGRANT_VAGRANTFILE` env var only applies to the project Vagrantfile name. [GH-2130] + - core: Fix an issue where the data directory would be deleted too + quickly in a multi-VM environment. - provisioners/chef: Work even with restrictive umask on user. [GH-2121] - provisioners/chef: Fix environment validation to be less restrictive. - provisioners/puppet: No more "shared folders cannot be found" error. diff --git a/lib/vagrant/plugin/v2/command.rb b/lib/vagrant/plugin/v2/command.rb index 59d343c89..918225974 100644 --- a/lib/vagrant/plugin/v2/command.rb +++ b/lib/vagrant/plugin/v2/command.rb @@ -84,6 +84,9 @@ module Vagrant names ||= [] names = [names] if !names.is_a?(Array) + # Cache the active machines outside the loop + active_machines = @env.active_machines + # This is a helper that gets a single machine with the proper # provider. The "proper provider" in this case depends on what was # given: @@ -101,7 +104,7 @@ module Vagrant provider_to_use = options[:provider] provider_to_use = provider_to_use.to_sym if provider_to_use - @env.active_machines.each do |active_name, active_provider| + active_machines.each do |active_name, active_provider| if name == active_name # We found an active machine with the same name