From ee8f9625379d0a58e2346b6fc1341225bdfe7997 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Wed, 4 Dec 2013 17:24:23 -0300 Subject: [PATCH 1/7] Fix plugin loading Regression from d354cdd. --- lib/vagrant/environment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vagrant/environment.rb b/lib/vagrant/environment.rb index 46899197c..62d059dd1 100644 --- a/lib/vagrant/environment.rb +++ b/lib/vagrant/environment.rb @@ -755,9 +755,9 @@ module Vagrant next end - @logger.info("Loading plugin from JSON: #{plugin}") + @logger.info("Loading plugin from JSON: #{name}") begin - Vagrant.require_plugin(plugin) + Vagrant.require_plugin(name) rescue Errors::PluginLoadError => e @ui.error(e.message + "\n") rescue Errors::PluginLoadFailed => e From 294f4def91e13d994b236390c62a672820fba6f7 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Wed, 4 Dec 2013 18:23:03 -0300 Subject: [PATCH 2/7] Fix `vagrant plugin` commands `StateFile#installed_plugins` returns now a Hash instead of Array. Fixes regression from 39b2539. --- plugins/commands/plugin/action/license_plugin.rb | 2 +- plugins/commands/plugin/action/list_plugins.rb | 2 +- plugins/commands/plugin/action/plugin_exists_check.rb | 2 +- plugins/commands/plugin/action/prune_gems.rb | 2 +- plugins/commands/plugin/state_file.rb | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/commands/plugin/action/license_plugin.rb b/plugins/commands/plugin/action/license_plugin.rb index b69e52749..518c1824c 100644 --- a/plugins/commands/plugin/action/license_plugin.rb +++ b/plugins/commands/plugin/action/license_plugin.rb @@ -18,7 +18,7 @@ module VagrantPlugins def call(env) # Get the list of installed plugins according to the state file - installed = Set.new(env[:plugin_state_file].installed_plugins) + installed = env[:plugin_state_file].installed_plugins.keys # If the plugin we're trying to license doesn't exist in the # state file, then it is an error. diff --git a/plugins/commands/plugin/action/list_plugins.rb b/plugins/commands/plugin/action/list_plugins.rb index b3a3392b1..f5dd0574b 100644 --- a/plugins/commands/plugin/action/list_plugins.rb +++ b/plugins/commands/plugin/action/list_plugins.rb @@ -18,7 +18,7 @@ module VagrantPlugins def call(env) # Get the list of installed plugins according to the state file - installed = Set.new(env[:plugin_state_file].installed_plugins) + installed = env[:plugin_state_file].installed_plugins.keys # Go through the plugins installed in this environment and # get the latest version of each. diff --git a/plugins/commands/plugin/action/plugin_exists_check.rb b/plugins/commands/plugin/action/plugin_exists_check.rb index c56bd9c14..abe8d43cf 100644 --- a/plugins/commands/plugin/action/plugin_exists_check.rb +++ b/plugins/commands/plugin/action/plugin_exists_check.rb @@ -12,7 +12,7 @@ module VagrantPlugins def call(env) # Get the list of installed plugins according to the state file - installed = Set.new(env[:plugin_state_file].installed_plugins) + installed = env[:plugin_state_file].installed_plugins.keys if !installed.include?(env[:plugin_name]) raise Vagrant::Errors::PluginNotInstalled, name: env[:plugin_name] diff --git a/plugins/commands/plugin/action/prune_gems.rb b/plugins/commands/plugin/action/prune_gems.rb index ae5a38196..d5e754994 100644 --- a/plugins/commands/plugin/action/prune_gems.rb +++ b/plugins/commands/plugin/action/prune_gems.rb @@ -34,7 +34,7 @@ module VagrantPlugins @logger.info("Pruning gems...") # Get the list of installed plugins according to the state file - installed = Set.new(env[:plugin_state_file].installed_plugins) + installed = env[:plugin_state_file].installed_plugins.keys # Get the actual specifications of installed gems all_specs = env[:gem_helper].with_environment do diff --git a/plugins/commands/plugin/state_file.rb b/plugins/commands/plugin/state_file.rb index 6860bdd09..7846bf7b0 100644 --- a/plugins/commands/plugin/state_file.rb +++ b/plugins/commands/plugin/state_file.rb @@ -32,11 +32,11 @@ module VagrantPlugins save! end - # This returns a list of installed plugins according to the state + # This returns a hash of installed plugins according to the state # file. Note that this may _not_ directly match over to actually # installed gems. # - # @return [Array] + # @return [Hash] def installed_plugins @data["installed"] end From c7a5592b96563fa9cd0a6d9555d5c7b313e5b6c2 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Wed, 4 Dec 2013 22:07:41 -0200 Subject: [PATCH 3/7] provisioners/docker: Ensure checks for whether the container exists / is running works accross multiple Docker versions [GH-2579] --- plugins/provisioners/docker/docker_client.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/plugins/provisioners/docker/docker_client.rb b/plugins/provisioners/docker/docker_client.rb index 535c6e9fc..b0a318bdf 100644 --- a/plugins/provisioners/docker/docker_client.rb +++ b/plugins/provisioners/docker/docker_client.rb @@ -44,15 +44,21 @@ module VagrantPlugins id = "$(cat #{config[:cidfile]})" - if container_exist?(id) + if container_exists?(id) start_container(id) else create_container(config) end end - def container_exist?(id) - @machine.communicate.test("sudo docker ps -a -q | grep -q #{id}") + def container_exists?(id) + @machine.communicate.tap do |comm| + # Docker < 0.7.0 stores container IDs using its short version while + # recent versions use the full container ID + # See https://github.com/dotcloud/docker/pull/2140 for more information + return comm.test("sudo docker ps -a -q | grep -wFq #{id}") || + comm.test("sudo docker ps -a -q -notrunc | grep -wFq #{id}") + end end def start_container(id) @@ -62,7 +68,13 @@ module VagrantPlugins end def container_running?(id) - @machine.communicate.test("sudo docker ps -q | grep #{id}") + @machine.communicate.tap do |comm| + # Docker < 0.7.0 stores container IDs using its short version while + # recent versions use the full container ID + # See https://github.com/dotcloud/docker/pull/2140 for more information + return comm.test("sudo docker ps -q | grep -wFq #{id}") || + comm.test("sudo docker ps -q -notrunc | grep -wFq #{id}") + end end def create_container(config) From 7e0b0a5a3c7df4e78184f11f5dabbd3c231e6371 Mon Sep 17 00:00:00 2001 From: Fabio Rehm Date: Wed, 4 Dec 2013 22:13:17 -0200 Subject: [PATCH 4/7] provisioners/docker: Extract container lookup method --- plugins/provisioners/docker/docker_client.rb | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/plugins/provisioners/docker/docker_client.rb b/plugins/provisioners/docker/docker_client.rb index b0a318bdf..7affc7c3a 100644 --- a/plugins/provisioners/docker/docker_client.rb +++ b/plugins/provisioners/docker/docker_client.rb @@ -52,13 +52,7 @@ module VagrantPlugins end def container_exists?(id) - @machine.communicate.tap do |comm| - # Docker < 0.7.0 stores container IDs using its short version while - # recent versions use the full container ID - # See https://github.com/dotcloud/docker/pull/2140 for more information - return comm.test("sudo docker ps -a -q | grep -wFq #{id}") || - comm.test("sudo docker ps -a -q -notrunc | grep -wFq #{id}") - end + lookup_container(id, true) end def start_container(id) @@ -68,13 +62,7 @@ module VagrantPlugins end def container_running?(id) - @machine.communicate.tap do |comm| - # Docker < 0.7.0 stores container IDs using its short version while - # recent versions use the full container ID - # See https://github.com/dotcloud/docker/pull/2140 for more information - return comm.test("sudo docker ps -q | grep -wFq #{id}") || - comm.test("sudo docker ps -q -notrunc | grep -wFq #{id}") - end + lookup_container(id) end def create_container(config) @@ -85,6 +73,18 @@ module VagrantPlugins docker run #{args} #{config[:image]} #{config[:cmd]} ] end + + def lookup_container(id, list_all = false) + docker_ps = "sudo docker ps -q" + docker_ps << " -a" if list_all + @machine.communicate.tap do |comm| + # Docker < 0.7.0 stores container IDs using its short version while + # recent versions use the full container ID + # See https://github.com/dotcloud/docker/pull/2140 for more information + return comm.test("#{docker_ps} | grep -wFq #{id}") || + comm.test("#{docker_ps} -notrunc | grep -wFq #{id}") + end + end end end end From 897fde327442662d1a02d309f3455e1628889e79 Mon Sep 17 00:00:00 2001 From: Teemu Matilainen Date: Thu, 5 Dec 2013 00:21:16 -0300 Subject: [PATCH 5/7] Add missing argument to ProviderVirtualBox::SyncedFolder#driver call GH-2577 missed passing the `machine` to the `driver` method. --- plugins/providers/virtualbox/synced_folder.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/providers/virtualbox/synced_folder.rb b/plugins/providers/virtualbox/synced_folder.rb index 47b9c945e..52d642a05 100644 --- a/plugins/providers/virtualbox/synced_folder.rb +++ b/plugins/providers/virtualbox/synced_folder.rb @@ -62,7 +62,7 @@ module VagrantPlugins end def cleanup(machine) - driver.clear_shared_folders + driver(machine).clear_shared_folders end protected From 2f6d09af1a8e6066d80384b1dc98c9fe2b07cfee Mon Sep 17 00:00:00 2001 From: Benny Lichtner Date: Thu, 5 Dec 2013 10:02:29 -0800 Subject: [PATCH 6/7] fixed broken link --- website/docs/source/v2/vagrantfile/version.html.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/source/v2/vagrantfile/version.html.md b/website/docs/source/v2/vagrantfile/version.html.md index 6e28d6797..39e604a86 100644 --- a/website/docs/source/v2/vagrantfile/version.html.md +++ b/website/docs/source/v2/vagrantfile/version.html.md @@ -6,7 +6,7 @@ sidebar_current: "vagrantfile-version" # Configuration Version Configuration versions are the mechanism by which Vagrant 1.1+ is able -to remain [backwards compatible](v2/installation/backwards-compatibility.html) +to remain [backwards compatible](/v2/installation/backwards-compatibility.html) with Vagrant 1.0.x Vagrantfiles, while introducing dramatically new features and configuration options. From bebaa63063339875d1dc89a748ac40a32cce9528 Mon Sep 17 00:00:00 2001 From: John Bellone Date: Thu, 5 Dec 2013 15:24:53 -0500 Subject: [PATCH 7/7] [provisioner/chef]: Update base to fix typo. It seems this was introduced by accident with #2281. --- plugins/provisioners/chef/provisioner/base.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/provisioners/chef/provisioner/base.rb b/plugins/provisioners/chef/provisioner/base.rb index 9f41a0e95..f62666078 100644 --- a/plugins/provisioners/chef/provisioner/base.rb +++ b/plugins/provisioners/chef/provisioner/base.rb @@ -41,7 +41,7 @@ module VagrantPlugins def chown_provisioning_folder paths = [@config.provisioning_path, - @config.file_backup_pach, + @config.file_backup_path, @config.file_cache_path] @machine.communicate.tap do |comm|