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 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 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 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| diff --git a/plugins/provisioners/docker/docker_client.rb b/plugins/provisioners/docker/docker_client.rb index 535c6e9fc..7affc7c3a 100644 --- a/plugins/provisioners/docker/docker_client.rb +++ b/plugins/provisioners/docker/docker_client.rb @@ -44,15 +44,15 @@ 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) + lookup_container(id, true) end def start_container(id) @@ -62,7 +62,7 @@ module VagrantPlugins end def container_running?(id) - @machine.communicate.test("sudo docker ps -q | grep #{id}") + lookup_container(id) end def create_container(config) @@ -73,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 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.