Merge branch 'master' of github.com:mitchellh/vagrant
This commit is contained in:
commit
6b1493ec3f
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<String>]
|
||||
# @return [Hash]
|
||||
def installed_plugins
|
||||
@data["installed"]
|
||||
end
|
||||
|
|
|
@ -62,7 +62,7 @@ module VagrantPlugins
|
|||
end
|
||||
|
||||
def cleanup(machine)
|
||||
driver.clear_shared_folders
|
||||
driver(machine).clear_shared_folders
|
||||
end
|
||||
|
||||
protected
|
||||
|
|
|
@ -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|
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue