Merge branch 'master' of github.com:mitchellh/vagrant
This commit is contained in:
commit
6b1493ec3f
|
@ -755,9 +755,9 @@ module Vagrant
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
@logger.info("Loading plugin from JSON: #{plugin}")
|
@logger.info("Loading plugin from JSON: #{name}")
|
||||||
begin
|
begin
|
||||||
Vagrant.require_plugin(plugin)
|
Vagrant.require_plugin(name)
|
||||||
rescue Errors::PluginLoadError => e
|
rescue Errors::PluginLoadError => e
|
||||||
@ui.error(e.message + "\n")
|
@ui.error(e.message + "\n")
|
||||||
rescue Errors::PluginLoadFailed => e
|
rescue Errors::PluginLoadFailed => e
|
||||||
|
|
|
@ -18,7 +18,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
# Get the list of installed plugins according to the state file
|
# 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
|
# If the plugin we're trying to license doesn't exist in the
|
||||||
# state file, then it is an error.
|
# state file, then it is an error.
|
||||||
|
|
|
@ -18,7 +18,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
# Get the list of installed plugins according to the state file
|
# 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
|
# Go through the plugins installed in this environment and
|
||||||
# get the latest version of each.
|
# get the latest version of each.
|
||||||
|
|
|
@ -12,7 +12,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def call(env)
|
def call(env)
|
||||||
# Get the list of installed plugins according to the state file
|
# 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])
|
if !installed.include?(env[:plugin_name])
|
||||||
raise Vagrant::Errors::PluginNotInstalled,
|
raise Vagrant::Errors::PluginNotInstalled,
|
||||||
name: env[:plugin_name]
|
name: env[:plugin_name]
|
||||||
|
|
|
@ -34,7 +34,7 @@ module VagrantPlugins
|
||||||
@logger.info("Pruning gems...")
|
@logger.info("Pruning gems...")
|
||||||
|
|
||||||
# Get the list of installed plugins according to the state file
|
# 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
|
# Get the actual specifications of installed gems
|
||||||
all_specs = env[:gem_helper].with_environment do
|
all_specs = env[:gem_helper].with_environment do
|
||||||
|
|
|
@ -32,11 +32,11 @@ module VagrantPlugins
|
||||||
save!
|
save!
|
||||||
end
|
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
|
# file. Note that this may _not_ directly match over to actually
|
||||||
# installed gems.
|
# installed gems.
|
||||||
#
|
#
|
||||||
# @return [Array<String>]
|
# @return [Hash]
|
||||||
def installed_plugins
|
def installed_plugins
|
||||||
@data["installed"]
|
@data["installed"]
|
||||||
end
|
end
|
||||||
|
|
|
@ -62,7 +62,7 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup(machine)
|
def cleanup(machine)
|
||||||
driver.clear_shared_folders
|
driver(machine).clear_shared_folders
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -41,7 +41,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
def chown_provisioning_folder
|
def chown_provisioning_folder
|
||||||
paths = [@config.provisioning_path,
|
paths = [@config.provisioning_path,
|
||||||
@config.file_backup_pach,
|
@config.file_backup_path,
|
||||||
@config.file_cache_path]
|
@config.file_cache_path]
|
||||||
|
|
||||||
@machine.communicate.tap do |comm|
|
@machine.communicate.tap do |comm|
|
||||||
|
|
|
@ -44,15 +44,15 @@ module VagrantPlugins
|
||||||
|
|
||||||
id = "$(cat #{config[:cidfile]})"
|
id = "$(cat #{config[:cidfile]})"
|
||||||
|
|
||||||
if container_exist?(id)
|
if container_exists?(id)
|
||||||
start_container(id)
|
start_container(id)
|
||||||
else
|
else
|
||||||
create_container(config)
|
create_container(config)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def container_exist?(id)
|
def container_exists?(id)
|
||||||
@machine.communicate.test("sudo docker ps -a -q | grep -q #{id}")
|
lookup_container(id, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def start_container(id)
|
def start_container(id)
|
||||||
|
@ -62,7 +62,7 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def container_running?(id)
|
def container_running?(id)
|
||||||
@machine.communicate.test("sudo docker ps -q | grep #{id}")
|
lookup_container(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_container(config)
|
def create_container(config)
|
||||||
|
@ -73,6 +73,18 @@ module VagrantPlugins
|
||||||
docker run #{args} #{config[:image]} #{config[:cmd]}
|
docker run #{args} #{config[:image]} #{config[:cmd]}
|
||||||
]
|
]
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,7 +6,7 @@ sidebar_current: "vagrantfile-version"
|
||||||
# Configuration Version
|
# Configuration Version
|
||||||
|
|
||||||
Configuration versions are the mechanism by which Vagrant 1.1+ is able
|
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
|
with Vagrant 1.0.x Vagrantfiles, while introducing dramatically new features
|
||||||
and configuration options.
|
and configuration options.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue