Merge remote-tracking branch 'mitchellh/master' into feature-hyperv-integration-services-fresh
# Conflicts: # plugins/providers/hyperv/action/import.rb # plugins/providers/hyperv/config.rb # website/source/docs/hyperv/configuration.html.md
This commit is contained in:
commit
0534ebf895
11
CHANGELOG.md
11
CHANGELOG.md
|
@ -2,12 +2,21 @@
|
|||
|
||||
FEATURES:
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
|
||||
## 1.9.3 (March 21, 2017)
|
||||
|
||||
IMPROVEMENTS:
|
||||
|
||||
- command/plugin: Remove requirement for paths with no spaces [GH-7967]
|
||||
- core: Support host_ip for forwarded ports [GH-7035, GH-8350]
|
||||
- core: Include disk space hint in box install failure message [GH-8089]
|
||||
- core/bundler: Allow vagrant constraint matching in prerelease mode [GH-8341]
|
||||
- provisioner/docker: Include /bin/docker as valid path [GH-8390]
|
||||
- provider/hyperv: Support enabling Hyper-V nested virtualization [GH-8325, GH-7738]
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
|
@ -15,6 +24,8 @@ BUG FIXES:
|
|||
- contrib/bash: Handle path spaces in bash completion [GH-8337]
|
||||
- core: Fix box sorting on find and list [GH-7956, GH-8334]
|
||||
- core/bundler: Force path as preferred source on install [GH-8327]
|
||||
- core/provision: Update "never" behavior to match documentation [GH-8366, GH-8016]
|
||||
- plugins/push: Isolate deprecation to Atlas strategy only
|
||||
- plugins/synced_folders: Give UID/GID precedence if found within mount options
|
||||
[GH-8122, GH-8064, GH-7859]
|
||||
|
||||
|
|
|
@ -102,12 +102,17 @@ module Vagrant
|
|||
type_map = provisioner_type_map(env)
|
||||
provisioner_instances(env).each do |p, options|
|
||||
type_name = type_map[p]
|
||||
next if env[:provision_types] && \
|
||||
!env[:provision_types].include?(type_name) && \
|
||||
!env[:provision_types].include?(options[:name])
|
||||
|
||||
# Don't run if sentinel is around and we're not always running
|
||||
next if !provision_enabled && options[:run] != :always
|
||||
if options[:run] == :never
|
||||
next if env[:provision_types].nil? || !env[:provision_types].include?(options[:name])
|
||||
else
|
||||
next if env[:provision_types] && \
|
||||
!env[:provision_types].include?(type_name) && \
|
||||
!env[:provision_types].include?(options[:name])
|
||||
|
||||
# Don't run if sentinel is around and we're not always running
|
||||
next if !provision_enabled && options[:run] != :always
|
||||
end
|
||||
|
||||
name = type_name
|
||||
if options[:name]
|
||||
|
|
|
@ -29,11 +29,11 @@ module Vagrant
|
|||
end
|
||||
alias_method :non_deprecated_execute, :execute
|
||||
|
||||
def execute
|
||||
def execute(*args, &block)
|
||||
@env[:ui].warn(I18n.t("vagrant.commands.deprecated",
|
||||
name: deprecation_command_name
|
||||
) + "\n")
|
||||
non_deprecated_execute
|
||||
non_deprecated_execute(*args, &block)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -44,7 +44,7 @@ module Vagrant
|
|||
def self.included(klass)
|
||||
klass.include(CommandDeprecation)
|
||||
klass.class_eval do
|
||||
def execute
|
||||
def execute(*_)
|
||||
raise Vagrant::Errors::CommandDeprecated,
|
||||
name: deprecation_command_name
|
||||
end
|
||||
|
|
|
@ -70,8 +70,6 @@ module VagrantPlugins
|
|||
|
||||
return name
|
||||
end
|
||||
|
||||
include Vagrant::Util::CommandDeprecation::Complete
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,11 +21,13 @@ module VagrantPlugins
|
|||
differencing_disk = env[:machine].provider_config.differencing_disk
|
||||
auto_start_action = env[:machine].provider_config.auto_start_action
|
||||
auto_stop_action = env[:machine].provider_config.auto_stop_action
|
||||
enable_virtualization_extensions = env[:machine].provider_config.enable_virtualization_extensions
|
||||
vm_integration_services = env[:machine].provider_config.vm_integration_services
|
||||
|
||||
env[:ui].output("Configured Dynamic memory allocation, maxmemory is #{maxmemory}") if maxmemory
|
||||
env[:ui].output("Configured startup memory is #{memory}") if memory
|
||||
env[:ui].output("Configured cpus number is #{cpus}") if cpus
|
||||
env[:ui].output("Configured enable virtualization extensions is #{enable_virtualization_extensions}") if enable_virtualization_extensions
|
||||
env[:ui].output("Configured vmname is #{vmname}") if vmname
|
||||
env[:ui].output("Configured differencing disk instead of cloning") if differencing_disk
|
||||
env[:ui].output("Configured automatic start action is #{auto_start_action}") if auto_start_action
|
||||
|
@ -146,6 +148,7 @@ module VagrantPlugins
|
|||
options[:auto_start_action] = auto_start_action if auto_start_action
|
||||
options[:auto_stop_action] = auto_stop_action if auto_stop_action
|
||||
options[:differencing_disk] = differencing_disk if differencing_disk
|
||||
options[:enable_virtualization_extensions] = "$True" if enable_virtualization_extensions and enable_virtualization_extensions == true
|
||||
|
||||
env[:ui].detail("Creating and registering the VM...")
|
||||
server = env[:machine].provider.driver.import(options)
|
||||
|
|
|
@ -11,8 +11,9 @@ module VagrantPlugins
|
|||
attr_accessor :vlan_id # VLAN ID for network interface for the virtual machine. @return [Integer]
|
||||
attr_accessor :mac # MAC address for network interface for the virtual machine. @return [String]
|
||||
attr_accessor :differencing_disk # Create differencing disk instead of cloning whole VHD [Boolean]
|
||||
attr_accessor :auto_start_action #action on automatic start of VM. Values: Nothing, StartIfRunning, Start [String]
|
||||
attr_accessor :auto_stop_action #action on automatic stop of VM. Values: ShutDown, TurnOff, Save [String]
|
||||
attr_accessor :auto_start_action #action on automatic start of VM. Values: Nothing, StartIfRunning, Start
|
||||
attr_accessor :auto_stop_action #action on automatic stop of VM. Values: ShutDown, TurnOff, Save
|
||||
attr_accessor :enable_virtualization_extensions # Enable virtualization extensions (nested virtualization). Values: true, false
|
||||
attr_accessor :vm_integration_services # Options for VMServiceIntegration [Hash]
|
||||
|
||||
def initialize
|
||||
|
@ -26,6 +27,7 @@ module VagrantPlugins
|
|||
@differencing_disk = UNSET_VALUE
|
||||
@auto_start_action = UNSET_VALUE
|
||||
@auto_stop_action = UNSET_VALUE
|
||||
@enable_virtualization_extensions = UNSET_VALUE
|
||||
@vm_integration_services = {
|
||||
guest_service_interface: UNSET_VALUE,
|
||||
heartbeat: UNSET_VALUE,
|
||||
|
@ -49,6 +51,7 @@ module VagrantPlugins
|
|||
@differencing_disk = false if @differencing_disk == UNSET_VALUE
|
||||
@auto_start_action = nil if @auto_start_action == UNSET_VALUE
|
||||
@auto_stop_action = nil if @auto_stop_action == UNSET_VALUE
|
||||
@enable_virtualization_extensions = false if @enable_virtualization_extensions == UNSET_VALUE # TODO will this work?
|
||||
|
||||
@vm_integration_services.each { |key, value|
|
||||
@vm_integration_services[key] = nil if value == UNSET_VALUE
|
||||
|
|
|
@ -10,7 +10,8 @@ Param(
|
|||
[string]$cpus=$null,
|
||||
[string]$vmname=$null,
|
||||
[string]$auto_start_action=$null,
|
||||
[string]$auto_stop_action=$null
|
||||
[string]$auto_stop_action=$null,
|
||||
[string]$enable_virtualization_extensions=$False
|
||||
)
|
||||
|
||||
# Include the following modules
|
||||
|
@ -170,6 +171,11 @@ if ($generation -ne 1) {
|
|||
}
|
||||
}
|
||||
|
||||
# Enable nested virtualization if configured
|
||||
if ($enable_virtualization_extensions) {
|
||||
Set-VMProcessor -VM $vm -ExposeVirtualizationExtensions $true
|
||||
}
|
||||
|
||||
# A regular expression pattern to pull the number from controllers
|
||||
[regex]$rx="\d"
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ module VagrantPlugins
|
|||
# Driver for VirtualBox 5.1.x
|
||||
class Version_5_1 < Version_5_0
|
||||
def initialize(uuid)
|
||||
super()
|
||||
super
|
||||
|
||||
@logger = Log4r::Logger.new("vagrant::provider::virtualbox_5_1")
|
||||
end
|
||||
|
|
|
@ -5,6 +5,7 @@ module VagrantPlugins
|
|||
module DockerInstalled
|
||||
def self.docker_installed(machine)
|
||||
paths = [
|
||||
"/bin/docker",
|
||||
"/usr/bin/docker",
|
||||
"/usr/local/bin/docker",
|
||||
"/usr/sbin/docker",
|
||||
|
|
|
@ -73,6 +73,12 @@ module VagrantPlugins
|
|||
|
||||
return result
|
||||
end
|
||||
|
||||
include Vagrant::Util::CommandDeprecation::Complete
|
||||
|
||||
def deprecation_command_name
|
||||
"push (atlas strategy)"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -33,37 +33,35 @@ describe VagrantPlugins::CommandPush::Command do
|
|||
allow(env).to receive(:push)
|
||||
end
|
||||
|
||||
# NOTE: Disabled due to deprecation
|
||||
#
|
||||
# it "validates the pushes" do
|
||||
# expect(subject).to receive(:validate_pushes!).once
|
||||
# subject.execute
|
||||
# end
|
||||
it "validates the pushes" do
|
||||
expect(subject).to receive(:validate_pushes!).once
|
||||
subject.execute
|
||||
end
|
||||
|
||||
# it "delegates to Environment#push" do
|
||||
# expect(env).to receive(:push).once
|
||||
# subject.execute
|
||||
# end
|
||||
it "delegates to Environment#push" do
|
||||
expect(env).to receive(:push).once
|
||||
subject.execute
|
||||
end
|
||||
|
||||
# it "validates the configuration" do
|
||||
# iso_env.vagrantfile <<-EOH
|
||||
# Vagrant.configure("2") do |config|
|
||||
# config.vm.box = "hashicorp/precise64"
|
||||
it "validates the configuration" do
|
||||
iso_env.vagrantfile <<-EOH
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "hashicorp/precise64"
|
||||
|
||||
# config.push.define "noop" do |push|
|
||||
# push.bad = "ham"
|
||||
# end
|
||||
# end
|
||||
# EOH
|
||||
config.push.define "noop" do |push|
|
||||
push.bad = "ham"
|
||||
end
|
||||
end
|
||||
EOH
|
||||
|
||||
# subject = described_class.new(argv, iso_env.create_vagrant_env)
|
||||
# allow(subject).to receive(:validate_pushes!)
|
||||
# .and_return(:noop)
|
||||
subject = described_class.new(argv, iso_env.create_vagrant_env)
|
||||
allow(subject).to receive(:validate_pushes!)
|
||||
.and_return(:noop)
|
||||
|
||||
# expect { subject.execute }.to raise_error(Vagrant::Errors::ConfigInvalid) { |err|
|
||||
# expect(err.message).to include("The following settings shouldn't exist: bad")
|
||||
# }
|
||||
# end
|
||||
expect { subject.execute }.to raise_error(Vagrant::Errors::ConfigInvalid) { |err|
|
||||
expect(err.message).to include("The following settings shouldn't exist: bad")
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
describe "#validate_pushes!" do
|
||||
|
|
|
@ -27,154 +27,155 @@ describe VagrantPlugins::AtlasPush::Push do
|
|||
allow(Vagrant::Util::SafeExec).to receive(:exec)
|
||||
end
|
||||
|
||||
describe "#push" do
|
||||
it "pushes with the uploader" do
|
||||
allow(subject).to receive(:uploader_path).and_return("foo")
|
||||
# DEPRECATED
|
||||
# describe "#push" do
|
||||
# it "pushes with the uploader" do
|
||||
# allow(subject).to receive(:uploader_path).and_return("foo")
|
||||
|
||||
expect(subject).to receive(:execute).with("foo")
|
||||
# expect(subject).to receive(:execute).with("foo")
|
||||
|
||||
subject.push
|
||||
end
|
||||
# subject.push
|
||||
# end
|
||||
|
||||
it "raises an exception if the uploader couldn't be found" do
|
||||
expect(subject).to receive(:uploader_path).and_return(nil)
|
||||
# it "raises an exception if the uploader couldn't be found" do
|
||||
# expect(subject).to receive(:uploader_path).and_return(nil)
|
||||
|
||||
expect { subject.push }.to raise_error(
|
||||
VagrantPlugins::AtlasPush::Errors::UploaderNotFound)
|
||||
end
|
||||
end
|
||||
# expect { subject.push }.to raise_error(
|
||||
# VagrantPlugins::AtlasPush::Errors::UploaderNotFound)
|
||||
# end
|
||||
# end
|
||||
|
||||
describe "#execute" do
|
||||
let(:app) { "foo/bar" }
|
||||
# describe "#execute" do
|
||||
# let(:app) { "foo/bar" }
|
||||
|
||||
before do
|
||||
config.app = app
|
||||
end
|
||||
# before do
|
||||
# config.app = app
|
||||
# end
|
||||
|
||||
it "sends the basic flags" do
|
||||
expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
with("foo", "-vcs", app, env.root_path.to_s)
|
||||
# it "sends the basic flags" do
|
||||
# expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
# with("foo", "-vcs", app, env.root_path.to_s)
|
||||
|
||||
subject.execute("foo")
|
||||
end
|
||||
# subject.execute("foo")
|
||||
# end
|
||||
|
||||
it "doesn't send VCS if disabled" do
|
||||
expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
with("foo", app, env.root_path.to_s)
|
||||
# it "doesn't send VCS if disabled" do
|
||||
# expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
# with("foo", app, env.root_path.to_s)
|
||||
|
||||
config.vcs = false
|
||||
subject.execute("foo")
|
||||
end
|
||||
# config.vcs = false
|
||||
# subject.execute("foo")
|
||||
# end
|
||||
|
||||
it "sends includes" do
|
||||
expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
with("foo", "-vcs", "-include", "foo", "-include",
|
||||
"bar", app, env.root_path.to_s)
|
||||
# it "sends includes" do
|
||||
# expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
# with("foo", "-vcs", "-include", "foo", "-include",
|
||||
# "bar", app, env.root_path.to_s)
|
||||
|
||||
config.includes = ["foo", "bar"]
|
||||
subject.execute("foo")
|
||||
end
|
||||
# config.includes = ["foo", "bar"]
|
||||
# subject.execute("foo")
|
||||
# end
|
||||
|
||||
it "sends excludes" do
|
||||
expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
with("foo", "-vcs", "-exclude", "foo", "-exclude",
|
||||
"bar", app, env.root_path.to_s)
|
||||
# it "sends excludes" do
|
||||
# expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
# with("foo", "-vcs", "-exclude", "foo", "-exclude",
|
||||
# "bar", app, env.root_path.to_s)
|
||||
|
||||
config.excludes = ["foo", "bar"]
|
||||
subject.execute("foo")
|
||||
end
|
||||
# config.excludes = ["foo", "bar"]
|
||||
# subject.execute("foo")
|
||||
# end
|
||||
|
||||
it "sends custom server address" do
|
||||
expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
with("foo", "-vcs", "-address", "foo", app, env.root_path.to_s)
|
||||
# it "sends custom server address" do
|
||||
# expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
# with("foo", "-vcs", "-address", "foo", app, env.root_path.to_s)
|
||||
|
||||
config.address = "foo"
|
||||
subject.execute("foo")
|
||||
end
|
||||
# config.address = "foo"
|
||||
# subject.execute("foo")
|
||||
# end
|
||||
|
||||
it "sends custom token" do
|
||||
expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
with("foo", "-vcs", "-token", "atlas_token", app, env.root_path.to_s)
|
||||
# it "sends custom token" do
|
||||
# expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
# with("foo", "-vcs", "-token", "atlas_token", app, env.root_path.to_s)
|
||||
|
||||
config.token = "atlas_token"
|
||||
subject.execute("foo")
|
||||
end
|
||||
# config.token = "atlas_token"
|
||||
# subject.execute("foo")
|
||||
# end
|
||||
|
||||
context "when metadata is available" do
|
||||
let(:env) do
|
||||
iso_env = isolated_environment
|
||||
iso_env.vagrantfile <<-EOH
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.box = "hashicorp/precise64"
|
||||
config.vm.box_url = "https://atlas.hashicorp.com/hashicorp/precise64"
|
||||
end
|
||||
EOH
|
||||
iso_env.create_vagrant_env
|
||||
end
|
||||
# context "when metadata is available" do
|
||||
# let(:env) do
|
||||
# iso_env = isolated_environment
|
||||
# iso_env.vagrantfile <<-EOH
|
||||
# Vagrant.configure("2") do |config|
|
||||
# config.vm.box = "hashicorp/precise64"
|
||||
# config.vm.box_url = "https://atlas.hashicorp.com/hashicorp/precise64"
|
||||
# end
|
||||
# EOH
|
||||
# iso_env.create_vagrant_env
|
||||
# end
|
||||
|
||||
it "sends the metadata" do
|
||||
expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
with("foo", "-vcs", "-metadata", "box=hashicorp/precise64",
|
||||
"-metadata", "box_url=https://atlas.hashicorp.com/hashicorp/precise64",
|
||||
"-token", "atlas_token", app, env.root_path.to_s)
|
||||
# it "sends the metadata" do
|
||||
# expect(Vagrant::Util::SafeExec).to receive(:exec).
|
||||
# with("foo", "-vcs", "-metadata", "box=hashicorp/precise64",
|
||||
# "-metadata", "box_url=https://atlas.hashicorp.com/hashicorp/precise64",
|
||||
# "-token", "atlas_token", app, env.root_path.to_s)
|
||||
|
||||
config.token = "atlas_token"
|
||||
subject.execute("foo")
|
||||
end
|
||||
end
|
||||
end
|
||||
# config.token = "atlas_token"
|
||||
# subject.execute("foo")
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
|
||||
describe "#uploader_path" do
|
||||
let(:scratch) do
|
||||
Pathname.new(Dir.mktmpdir("vagrant-test-atlas-push-upload-path"))
|
||||
end
|
||||
# describe "#uploader_path" do
|
||||
# let(:scratch) do
|
||||
# Pathname.new(Dir.mktmpdir("vagrant-test-atlas-push-upload-path"))
|
||||
# end
|
||||
|
||||
after do
|
||||
FileUtils.rm_rf(scratch)
|
||||
end
|
||||
# after do
|
||||
# FileUtils.rm_rf(scratch)
|
||||
# end
|
||||
|
||||
it "should return the configured path if set" do
|
||||
config.uploader_path = "foo"
|
||||
expect(subject.uploader_path).to eq("foo")
|
||||
end
|
||||
# it "should return the configured path if set" do
|
||||
# config.uploader_path = "foo"
|
||||
# expect(subject.uploader_path).to eq("foo")
|
||||
# end
|
||||
|
||||
it "should look up the uploader via PATH if not set" do
|
||||
allow(Vagrant).to receive(:in_installer?).and_return(false)
|
||||
# it "should look up the uploader via PATH if not set" do
|
||||
# allow(Vagrant).to receive(:in_installer?).and_return(false)
|
||||
|
||||
expect(Vagrant::Util::Which).to receive(:which).
|
||||
with(described_class.const_get(:UPLOADER_BIN)).
|
||||
and_return("bar")
|
||||
# expect(Vagrant::Util::Which).to receive(:which).
|
||||
# with(described_class.const_get(:UPLOADER_BIN)).
|
||||
# and_return("bar")
|
||||
|
||||
expect(subject.uploader_path).to eq("bar")
|
||||
end
|
||||
# expect(subject.uploader_path).to eq("bar")
|
||||
# end
|
||||
|
||||
it "should look up the uploader in the embedded dir if installer" do
|
||||
allow(Vagrant).to receive(:in_installer?).and_return(true)
|
||||
allow(Vagrant).to receive(:installer_embedded_dir).and_return(scratch.to_s)
|
||||
# it "should look up the uploader in the embedded dir if installer" do
|
||||
# allow(Vagrant).to receive(:in_installer?).and_return(true)
|
||||
# allow(Vagrant).to receive(:installer_embedded_dir).and_return(scratch.to_s)
|
||||
|
||||
bin_path = scratch.join("bin", bin)
|
||||
bin_path.dirname.mkpath
|
||||
bin_path.open("w+") { |f| f.write("hi") }
|
||||
# bin_path = scratch.join("bin", bin)
|
||||
# bin_path.dirname.mkpath
|
||||
# bin_path.open("w+") { |f| f.write("hi") }
|
||||
|
||||
expect(subject.uploader_path).to eq(bin_path.to_s)
|
||||
end
|
||||
# expect(subject.uploader_path).to eq(bin_path.to_s)
|
||||
# end
|
||||
|
||||
it "should look up the uploader in the PATH if not in the installer" do
|
||||
allow(Vagrant).to receive(:in_installer?).and_return(true)
|
||||
allow(Vagrant).to receive(:installer_embedded_dir).and_return(scratch.to_s)
|
||||
# it "should look up the uploader in the PATH if not in the installer" do
|
||||
# allow(Vagrant).to receive(:in_installer?).and_return(true)
|
||||
# allow(Vagrant).to receive(:installer_embedded_dir).and_return(scratch.to_s)
|
||||
|
||||
expect(Vagrant::Util::Which).to receive(:which).
|
||||
with(described_class.const_get(:UPLOADER_BIN)).
|
||||
and_return("bar")
|
||||
# expect(Vagrant::Util::Which).to receive(:which).
|
||||
# with(described_class.const_get(:UPLOADER_BIN)).
|
||||
# and_return("bar")
|
||||
|
||||
expect(subject.uploader_path).to eq("bar")
|
||||
end
|
||||
# expect(subject.uploader_path).to eq("bar")
|
||||
# end
|
||||
|
||||
it "should return nil if its not found anywhere" do
|
||||
allow(Vagrant).to receive(:in_installer?).and_return(false)
|
||||
allow(Vagrant::Util::Which).to receive(:which).and_return(nil)
|
||||
# it "should return nil if its not found anywhere" do
|
||||
# allow(Vagrant).to receive(:in_installer?).and_return(false)
|
||||
# allow(Vagrant::Util::Which).to receive(:which).and_return(nil)
|
||||
|
||||
expect(subject.uploader_path).to be_nil
|
||||
end
|
||||
end
|
||||
# expect(subject.uploader_path).to be_nil
|
||||
# end
|
||||
# end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,208 @@
|
|||
require File.expand_path("../../../../base", __FILE__)
|
||||
|
||||
require Vagrant.source_root.join("plugins/kernel_v2/config/vm")
|
||||
|
||||
describe Vagrant::Action::Builtin::Provision do
|
||||
include_context "unit"
|
||||
|
||||
let(:app) { lambda { |env| } }
|
||||
let(:env) {
|
||||
{ machine: machine, ui: ui, hook: hook, provision_ignore_sentinel: false }
|
||||
}
|
||||
let(:hook){ double("hook") }
|
||||
|
||||
let(:machine) do
|
||||
double("machine").tap do |machine|
|
||||
allow(machine).to receive(:id).and_return('machine-id')
|
||||
allow(machine).to receive(:data_dir).and_return(data_dir)
|
||||
allow(machine).to receive(:config).and_return(machine_config)
|
||||
allow(machine).to receive(:env).and_return(machine_env)
|
||||
end
|
||||
end
|
||||
|
||||
let(:machine_config) do
|
||||
double("machine_config").tap do |config|
|
||||
config.stub(vm: vm_config)
|
||||
end
|
||||
end
|
||||
|
||||
let(:data_dir){ temporary_dir }
|
||||
|
||||
let(:machine_env) do
|
||||
isolated_environment.tap do |i_env|
|
||||
allow(i_env).to receive(:data_dir).and_return(data_dir)
|
||||
allow(i_env).to receive(:lock).and_yield
|
||||
end
|
||||
end
|
||||
|
||||
let(:vm_config) do
|
||||
double("machine_vm_config").tap do |config|
|
||||
allow(config).to receive(:provisioners).and_return([])
|
||||
end
|
||||
end
|
||||
|
||||
let(:ui) do
|
||||
double("ui").tap do |result|
|
||||
allow(result).to receive(:info)
|
||||
end
|
||||
end
|
||||
|
||||
let(:instance){ described_class.new(app, env) }
|
||||
|
||||
describe "#call" do
|
||||
context "with no provisioners defined" do
|
||||
it "should process empty set of provisioners" do
|
||||
expect(instance.call(env)).to eq([])
|
||||
end
|
||||
|
||||
context "with provisioning disabled" do
|
||||
before{ env[:provision_enabled] = false }
|
||||
after{ env.delete(:provision_enabled) }
|
||||
|
||||
it "should not process any provisioners" do
|
||||
expect(instance.call(env)).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "with single provisioner defined" do
|
||||
let(:provisioner) do
|
||||
prov = VagrantPlugins::Kernel_V2::VagrantConfigProvisioner.new("spec-test", :shell)
|
||||
prov.config = provisioner_config
|
||||
prov
|
||||
end
|
||||
let(:provisioner_config){ {} }
|
||||
|
||||
before{ expect(vm_config).to receive(:provisioners).and_return([provisioner]) }
|
||||
|
||||
it "should call the defined provisioner" do
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
context "with provisioning disabled" do
|
||||
before{ env[:provision_enabled] = false }
|
||||
after{ env.delete(:provision_enabled) }
|
||||
|
||||
it "should not process any provisioners" do
|
||||
expect(hook).not_to receive(:call).with(:provisioner_run, anything)
|
||||
expect(instance.call(env)).to be_nil
|
||||
end
|
||||
end
|
||||
|
||||
context "with provisioner configured to run once" do
|
||||
before{ provisioner.run = :once }
|
||||
|
||||
it "should run if machine is not provisioned" do
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should not run if machine is provisioned" do
|
||||
File.open(File.join(data_dir.to_s, "action_provision"), "w") do |file|
|
||||
file.write("1.5:machine-id")
|
||||
end
|
||||
expect(hook).not_to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should not run if provision types are set and provisioner is not included" do
|
||||
env[:provision_types] = ["other-provisioner", "other-test"]
|
||||
expect(hook).not_to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should run if provision types are set and include provisioner name" do
|
||||
env[:provision_types] = ["spec-test"]
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should run if provision types are set and include provisioner type" do
|
||||
env[:provision_types] = [:shell]
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
end
|
||||
|
||||
context "with provisioner configured to run always" do
|
||||
before{ provisioner.run = :always }
|
||||
|
||||
it "should run if machine is not provisioned" do
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should run if machine is provisioned" do
|
||||
File.open(File.join(data_dir.to_s, "action_provision"), "w") do |file|
|
||||
file.write("1.5:machine-id")
|
||||
end
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should not run if provision types are set and provisioner is not included" do
|
||||
env[:provision_types] = ["other-provisioner", "other-test"]
|
||||
expect(hook).not_to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should run if provision types are set and include provisioner name" do
|
||||
env[:provision_types] = ["spec-test"]
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should run if provision types are set and include provisioner type" do
|
||||
env[:provision_types] = [:shell]
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
end
|
||||
|
||||
context "with provisioner configured to never run" do
|
||||
before{ provisioner.run = :never }
|
||||
|
||||
it "should not run if machine is not provisioned" do
|
||||
expect(hook).not_to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should not run if machine is provisioned" do
|
||||
File.open(File.join(data_dir.to_s, "action_provision"), "w") do |file|
|
||||
file.write("1.5:machine-id")
|
||||
end
|
||||
expect(hook).not_to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should not run if provision types are set and provisioner is not included" do
|
||||
env[:provision_types] = ["other-provisioner", "other-test"]
|
||||
expect(hook).not_to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should run if provision types are set and include provisioner name" do
|
||||
env[:provision_types] = ["spec-test"]
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should run if provision types are set and include provisioner name and machine is provisioned" do
|
||||
File.open(File.join(data_dir.to_s, "action_provision"), "w") do |file|
|
||||
file.write("1.5:machine-id")
|
||||
end
|
||||
env[:provision_types] = ["spec-test"]
|
||||
expect(hook).to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
|
||||
it "should not run if provision types are set and include provisioner type" do
|
||||
env[:provision_types] = [:shell]
|
||||
expect(hook).not_to receive(:call).with(:provisioner_run, anything)
|
||||
instance.call(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -56,11 +56,11 @@ Vagrant.configure(2) do |global_config|
|
|||
vmware.vmx['vhv.allow'] = 'TRUE'
|
||||
end
|
||||
config.vm.provision :shell, path: "./scripts/#{platform}-setup.#{provider_name}.sh", run: "once"
|
||||
GUEST_BOXES.each_with_index do |box_info, idx|
|
||||
guest_boxes.each_with_index do |box_info, idx|
|
||||
guest_box, box_version = box_info
|
||||
spec_cmd_args = ENV["VAGRANT_SPEC_ARGS"]
|
||||
if idx != 0
|
||||
spec_cmd_args = "#{spec_cmd_args} --without-component 'cli/*'".strip
|
||||
spec_cmd_args = "#{spec_cmd_args} --without-component cli/*".strip
|
||||
end
|
||||
config.vm.provision(
|
||||
:shell,
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
export VAGRANT_SPEC_BOX="${VAGRANT_SPEC_BOX}"
|
||||
vagrant vagrant-spec ${VAGRANT_SPEC_ARGS} /vagrant/test/vagrant-spec/configs/vagrant-spec.config.virtualbox.rb
|
||||
result=$?
|
||||
|
||||
exit $result
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
set -xe
|
||||
|
||||
curl -Lo /etc/yum.repos.d/virtualbox.repo http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
|
||||
yum groupinstall -y "Development Tools"
|
||||
yum install -y kernel-devel
|
||||
yum install -y VirtualBox-${VAGRANT_CENTOS_VIRTUALBOX_VERSION:-5.1}
|
||||
|
||||
pushd /vagrant
|
||||
|
||||
rpm -ivh ./pkg/dist/vagrant_*_x86_64.rpm
|
||||
vagrant plugin install ./vagrant-spec.gem
|
||||
|
||||
popd
|
|
@ -1 +1 @@
|
|||
1.9.3.dev
|
||||
1.9.4.dev
|
||||
|
|
|
@ -2,7 +2,7 @@ set :base_url, "https://www.vagrantup.com/"
|
|||
|
||||
activate :hashicorp do |h|
|
||||
h.name = "vagrant"
|
||||
h.version = "1.9.2"
|
||||
h.version = "1.9.3"
|
||||
h.github_slug = "mitchellh/vagrant"
|
||||
end
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ you may set. A complete reference is shown below:
|
|||
virtual machine to report an IP address. This defaults to 120 seconds.
|
||||
This may have to be increased if your VM takes longer to boot.
|
||||
* `differencing_disk` (boolean) - Switch to use differencing disk intead of cloning whole VHD.
|
||||
* `enable_virtualization_extensions` (boolean) - Enable virtualization extensions for the virtual CPUs.
|
||||
This allows Hyper-V to be nested and run inside another Hyper-VM VM. It requires Windows 10 - 1511 (build 10586) or newer.
|
||||
Default is not defined. This will be disabled if not set.
|
||||
* `vm_integration_services` (Hash) - Hash to set the state of integration services.
|
||||
|
||||
Example:
|
||||
|
|
|
@ -14,7 +14,7 @@ Vagrant comes with support out of the box for [Hyper-V](https://en.wikipedia.org
|
|||
a native hypervisor written by Microsoft. Hyper-V is available by default for
|
||||
almost all Windows 8.1 installs.
|
||||
|
||||
The Hyper-V provider is compatible with Windows 8.1 only. Prior versions
|
||||
The Hyper-V provider is compatible with Windows 8.1 and later only. Prior versions
|
||||
of Hyper-V do not include the necessary APIs for Vagrant to work.
|
||||
|
||||
Hyper-V must be enabled prior to using the provider. Most Windows installations
|
||||
|
|
Loading…
Reference in New Issue