Merge remote branch 'remotes/upstream/master' into redhat-distro
This commit is contained in:
commit
a1e864e3ff
24
CHANGELOG.md
24
CHANGELOG.md
|
@ -1,4 +1,24 @@
|
|||
## 0.6.9 (unreleased)
|
||||
## 0.7.0.beta2 (unreleased)
|
||||
|
||||
- Use numeric uid/gid in mounting shared folders to increase portability. [GH-252]
|
||||
- HTTP downloading follows redirects. [GH-163]
|
||||
- Downloaders have clearer output to note what they're doing.
|
||||
- Shared folders with no guest path are not automounted. [GH-184]
|
||||
- Boxes downloaded during `vagrant up` reload the Vagrantfile config, which
|
||||
fixes a problem with box settings not being properly loaded. [GH-231]
|
||||
|
||||
## 0.7.0.beta (December 24, 2010)
|
||||
|
||||
- VirtualBox 4.0 support. Support for VirtualBox 3.2 is _dropped_, since
|
||||
the API is so different. Stay with the 0.6.x series if you have VirtualBox
|
||||
3.2.x.
|
||||
- Changed the unused host only network destroy mechanism to check for
|
||||
uselessness after the VM is destroyed. This should result in more accurate
|
||||
checks.
|
||||
- Networks are no longer disabled upon halt/destroy. With the above
|
||||
change, its unnecessary.
|
||||
|
||||
## 0.6.9 (December 21, 2010)
|
||||
|
||||
- Puppet provisioner. [GH-223]
|
||||
- Solaris system configurable to use `sudo`.
|
||||
|
@ -10,6 +30,8 @@
|
|||
- Enumerate VMs in a multi-VM environment in order they were defined. [GH-244]
|
||||
- Check for VM boot changed to use `timeout` library, which works better with Windows.
|
||||
- Show special error if VirtualBox not detected on 64-bit Windows.
|
||||
- Show error to Windows users attempting to use host only networking since
|
||||
it doesn't work yet.
|
||||
|
||||
## 0.6.8 (November 30, 2010)
|
||||
|
||||
|
|
|
@ -54,3 +54,8 @@ be installed with a simple `gem install bundler --pre`. Afterwords, do the follo
|
|||
rake
|
||||
|
||||
This will run the test suite, which should come back all green! Then you're good to go!
|
||||
|
||||
If you want to run Vagrant without having to install the gem, you may use `bundle exec`,
|
||||
like so:
|
||||
|
||||
bundle exec bin/vagrant help
|
||||
|
|
|
@ -94,7 +94,7 @@ module Vagrant
|
|||
callable = callable_id
|
||||
callable = Builder.new.use(callable_id) if callable_id.kind_of?(Class)
|
||||
callable = self.class.actions[callable_id] if callable_id.kind_of?(Symbol)
|
||||
raise ArgumentError.new("Argument to run must be a callable object or registered action.") if !callable || !callable.respond_to?(:call)
|
||||
raise ArgumentError, "Argument to run must be a callable object or registered action." if !callable || !callable.respond_to?(:call)
|
||||
|
||||
action_environment = Action::Environment.new(env)
|
||||
action_environment.merge!(options || {})
|
||||
|
|
|
@ -33,7 +33,7 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
|
||||
raise Errors::BoxDownloadUnknownType.new if !@downloader
|
||||
raise Errors::BoxDownloadUnknownType if !@downloader
|
||||
|
||||
@downloader.prepare(@env["box"].uri)
|
||||
true
|
||||
|
@ -64,7 +64,6 @@ module Vagrant
|
|||
end
|
||||
|
||||
def download_to(f)
|
||||
@env.ui.info I18n.t("vagrant.actions.box.download.copying")
|
||||
@downloader.download!(@env["box"].uri, f)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
def setup_box_directory
|
||||
raise Errors::BoxAlreadyExists.new(:name => @env["box"].name) if File.directory?(@env["box"].directory)
|
||||
raise Errors::BoxAlreadyExists, :name => @env["box"].name if File.directory?(@env["box"].directory)
|
||||
|
||||
FileUtils.mkdir_p(@env["box"].directory)
|
||||
@box_directory = @env["box"].directory
|
||||
|
|
|
@ -12,7 +12,7 @@ module Vagrant
|
|||
env.ui.info I18n.t("vagrant.actions.box.verify.verifying")
|
||||
VirtualBox::Appliance.new(env["box"].ovf_file.to_s)
|
||||
rescue Exception
|
||||
raise Errors::BoxVerificationFailed.new
|
||||
raise Errors::BoxVerificationFailed
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
|
|
|
@ -30,7 +30,6 @@ module Vagrant
|
|||
register(:halt, Builder.new do
|
||||
use VM::DiscardState
|
||||
use VM::Halt
|
||||
use VM::DisableNetworks
|
||||
end)
|
||||
|
||||
# suspend - Suspends the VM
|
||||
|
@ -62,9 +61,9 @@ module Vagrant
|
|||
register(:destroy, Builder.new do
|
||||
use Action[:halt], :force => true
|
||||
use VM::ClearNFSExports
|
||||
use VM::DestroyUnusedNetworkInterfaces
|
||||
use VM::Destroy
|
||||
use VM::CleanMachineFolder
|
||||
use VM::DestroyUnusedNetworkInterfaces
|
||||
end)
|
||||
|
||||
# package - Export and package the VM
|
||||
|
|
|
@ -28,8 +28,8 @@ module Vagrant
|
|||
def call(env)
|
||||
@env = env
|
||||
|
||||
raise Errors::PackageOutputExists.new if File.exist?(tar_path)
|
||||
raise Errors::PackageRequiresDirectory.new if !@env["package.directory"] || !File.directory?(@env["package.directory"])
|
||||
raise Errors::PackageOutputExists if File.exist?(tar_path)
|
||||
raise Errors::PackageRequiresDirectory if !@env["package.directory"] || !File.directory?(@env["package.directory"])
|
||||
|
||||
verify_files_to_copy
|
||||
compress
|
||||
|
@ -57,7 +57,7 @@ module Vagrant
|
|||
|
||||
def verify_files_to_copy
|
||||
files_to_copy.each do |file, _|
|
||||
raise Errors::PackageIncludeMissing.new(:file => file) if !File.exist?(file)
|
||||
raise Errors::PackageIncludeMissing, :file => file if !File.exist?(file)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ module Vagrant
|
|||
|
||||
# Start up the VM and wait for it to boot.
|
||||
boot
|
||||
raise Errors::VMFailedToBoot.new if !wait_for_boot
|
||||
raise Errors::VMFailedToBoot if !wait_for_boot
|
||||
@app.call(env)
|
||||
end
|
||||
|
||||
|
|
|
@ -8,15 +8,16 @@ module Vagrant
|
|||
|
||||
def call(env)
|
||||
box_name = env["config"].vm.box
|
||||
raise Errors::BoxNotSpecified.new if !box_name
|
||||
raise Errors::BoxNotSpecified if !box_name
|
||||
|
||||
if !env.env.boxes.find(box_name)
|
||||
box_url = env["config"].vm.box_url
|
||||
raise Errors::BoxSpecifiedDoesntExist.new(:name => box_name) if !box_url
|
||||
raise Errors::BoxSpecifiedDoesntExist, :name => box_name if !box_url
|
||||
|
||||
env.ui.info I18n.t("vagrant.actions.vm.check_box.not_found", :name => box_name)
|
||||
Vagrant::Box.add(env.env, box_name, box_url)
|
||||
env["boxes"].reload!
|
||||
env.env.reload_config!
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
|
|
|
@ -31,7 +31,7 @@ module Vagrant
|
|||
keep = Dir["#{f}/**/*"].find do |d|
|
||||
# Find a file that doesn't have ".xml-prev" as the suffix,
|
||||
# which signals that we want to keep this folder
|
||||
File.file?(d) && !(File.basename(d) =~ /\.xml-prev$/)
|
||||
File.file?(d) && !(File.basename(d) =~ /\.vbox-prev$/)
|
||||
end
|
||||
|
||||
FileUtils.rm_rf(f) if !keep
|
||||
|
|
|
@ -8,7 +8,7 @@ module Vagrant
|
|||
|
||||
def call(env)
|
||||
env.ui.info I18n.t("vagrant.actions.vm.destroy.destroying")
|
||||
env["vm"].vm.destroy(:destroy_medium => :delete)
|
||||
env["vm"].vm.destroy
|
||||
env["vm"].vm = nil
|
||||
|
||||
@app.call(env)
|
||||
|
|
|
@ -9,20 +9,15 @@ module Vagrant
|
|||
end
|
||||
|
||||
def call(env)
|
||||
# We need to check if the host only network specified by any
|
||||
# of the adapters would not have any more clients if it was
|
||||
# destroyed. And if so, then destroy the host only network
|
||||
# itself.
|
||||
interfaces = env["vm"].vm.network_adapters.collect do |adapter|
|
||||
adapter.host_interface_object
|
||||
end
|
||||
# Destroy all the host only network adapters which are empty.
|
||||
VirtualBox::Global.global(true).host.network_interfaces.each do |iface|
|
||||
# We only care about host only interfaces
|
||||
next if iface.interface_type != :host_only
|
||||
|
||||
interfaces.compact.uniq.each do |interface|
|
||||
# Destroy the network interface if there is only one
|
||||
# attached VM (which must be this VM)
|
||||
if interface.attached_vms.length == 1
|
||||
# Destroy it if there is nothing attached
|
||||
if iface.attached_vms.empty?
|
||||
env.ui.info I18n.t("vagrant.actions.vm.destroy_network.destroying")
|
||||
interface.destroy
|
||||
iface.destroy
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
module Vagrant
|
||||
class Action
|
||||
module VM
|
||||
# Middleware to disable all host only networks on the
|
||||
# VM
|
||||
class DisableNetworks
|
||||
def initialize(app, env)
|
||||
@app = app
|
||||
@env = env
|
||||
end
|
||||
|
||||
def call(env)
|
||||
if env["vm"].created?
|
||||
logged = false
|
||||
|
||||
env["vm"].vm.network_adapters.each do |adapter|
|
||||
next if adapter.attachment_type != :host_only
|
||||
|
||||
if !logged
|
||||
env.ui.info I18n.t("vagrant.actions.vm.disable_networks.disabling")
|
||||
logged = true
|
||||
end
|
||||
|
||||
adapter.enabled = false
|
||||
adapter.save
|
||||
end
|
||||
end
|
||||
|
||||
@app.call(env)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -14,7 +14,7 @@ module Vagrant
|
|||
def call(env)
|
||||
@env = env
|
||||
|
||||
raise Errors::VMPowerOffToPackage.new if !@env["vm"].vm.powered_off?
|
||||
raise Errors::VMPowerOffToPackage if !@env["vm"].vm.powered_off?
|
||||
|
||||
setup_temp_dir
|
||||
export
|
||||
|
|
|
@ -23,7 +23,7 @@ module Vagrant
|
|||
# 1024, which causes the forwarded ports to fail.
|
||||
def threshold_check
|
||||
@env.env.config.vm.forwarded_ports.each do |name, options|
|
||||
raise Errors::ForwardPortBelowThreshold.new if options[:hostport] <= 1024
|
||||
raise Errors::ForwardPortBelowThreshold if options[:hostport] <= 1024
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -47,9 +47,9 @@ module Vagrant
|
|||
if !options[:auto]
|
||||
# Auto fixing is disabled for this port forward, so we
|
||||
# must throw an error so the user can fix it.
|
||||
raise Errors::ForwardPortCollision.new(:name => name,
|
||||
:host_port => options[:hostport].to_s,
|
||||
:guest_port => options[:guestport].to_s)
|
||||
raise Errors::ForwardPortCollision, :name => name,
|
||||
:host_port => options[:hostport].to_s,
|
||||
:guest_port => options[:guestport].to_s
|
||||
end
|
||||
|
||||
# Get the auto port range and get rid of the used ports and
|
||||
|
@ -60,10 +60,10 @@ module Vagrant
|
|||
range -= existing_ports
|
||||
|
||||
if range.empty?
|
||||
raise Errors::ForwardPortAutolistEmpty.new(:vm_name => @env["vm"].name,
|
||||
:name => name,
|
||||
:host_port => options[:hostport].to_s,
|
||||
:guest_port => options[:guestport].to_s)
|
||||
raise Errors::ForwardPortAutolistEmpty, :vm_name => @env["vm"].name,
|
||||
:name => name,
|
||||
:host_port => options[:hostport].to_s,
|
||||
:guest_port => options[:guestport].to_s
|
||||
end
|
||||
|
||||
# Set the port up to be the first one and add that port to
|
||||
|
|
|
@ -15,7 +15,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
# Flag as erroneous and return if import failed
|
||||
raise Errors::VMImportFailure.new if !env["vm"].vm
|
||||
raise Errors::VMImportFailure if !env["vm"].vm
|
||||
|
||||
# Import completed successfully. Continue the chain
|
||||
@app.call(env)
|
||||
|
|
|
@ -8,8 +8,12 @@ module Vagrant
|
|||
@app = app
|
||||
@env = env
|
||||
|
||||
if enable_network? && Util::Platform.windows?
|
||||
raise Errors::NetworkNotImplemented
|
||||
end
|
||||
|
||||
env["config"].vm.network_options.compact.each do |network_options|
|
||||
raise Errors::NetworkCollision.new if !verify_no_bridge_collision(network_options)
|
||||
raise Errors::NetworkCollision if !verify_no_bridge_collision(network_options)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -83,7 +87,7 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
|
||||
raise Errors::NetworkNotFound.new(:name => net_options[:name]) if net_options[:name]
|
||||
raise Errors::NetworkNotFound, :name => net_options[:name] if net_options[:name]
|
||||
|
||||
# One doesn't exist, create it.
|
||||
@env.ui.info I18n.t("vagrant.actions.vm.network.creating")
|
||||
|
|
|
@ -113,7 +113,9 @@ module Vagrant
|
|||
def mount_folders
|
||||
@env.ui.info I18n.t("vagrant.actions.vm.nfs.mounting")
|
||||
|
||||
@env["vm"].system.mount_nfs(host_ip, folders)
|
||||
# Only mount the folders which have a guest path specified
|
||||
am_folders = folders.select { |folder| folder[:guestpath] }
|
||||
@env["vm"].system.mount_nfs(host_ip, am_folders)
|
||||
end
|
||||
|
||||
# Returns the IP address of the first host only network adapter
|
||||
|
@ -147,9 +149,9 @@ module Vagrant
|
|||
|
||||
# Verifies that the host is set and supports NFS.
|
||||
def verify_settings
|
||||
raise Errors::NFSHostRequired.new if @env["host"].nil?
|
||||
raise Errors::NFSNotSupported.new if !@env["host"].nfs?
|
||||
raise Errors::NFSNoHostNetwork.new if @env["config"].vm.network_options.empty?
|
||||
raise Errors::NFSHostRequired if @env["host"].nil?
|
||||
raise Errors::NFSNotSupported if !@env["host"].nfs?
|
||||
raise Errors::NFSNoHostNetwork if @env["config"].vm.network_options.empty?
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,7 +28,7 @@ module Vagrant
|
|||
|
||||
if provisioner.is_a?(Class)
|
||||
@provisioner = provisioner.new(@env)
|
||||
raise Errors::ProvisionInvalidClass.new if !@provisioner.is_a?(Provisioners::Base)
|
||||
raise Errors::ProvisionInvalidClass if !@provisioner.is_a?(Provisioners::Base)
|
||||
elsif provisioner.is_a?(Symbol)
|
||||
# We have a few hard coded provisioners for built-ins
|
||||
mapping = {
|
||||
|
@ -38,7 +38,7 @@ module Vagrant
|
|||
}
|
||||
|
||||
provisioner_klass = mapping[provisioner]
|
||||
raise Errors::ProvisionUnknownType.new(:provisioner => provisioner.to_s) if provisioner_klass.nil?
|
||||
raise Errors::ProvisionUnknownType, :provisioner => provisioner.to_s if provisioner_klass.nil?
|
||||
@provisioner = provisioner_klass.new(@env)
|
||||
end
|
||||
|
||||
|
|
|
@ -50,10 +50,17 @@ module Vagrant
|
|||
|
||||
@env["vm"].ssh.execute do |ssh|
|
||||
shared_folders.each do |name, data|
|
||||
@env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
|
||||
:name => name,
|
||||
:guest_path => data[:guestpath]))
|
||||
@env["vm"].system.mount_shared_folder(ssh, name, data[:guestpath])
|
||||
if data[:guestpath]
|
||||
# Guest path specified, so mount the folder to specified point
|
||||
@env.ui.info(I18n.t("vagrant.actions.vm.share_folders.mounting_entry",
|
||||
:name => name,
|
||||
:guest_path => data[:guestpath]))
|
||||
@env["vm"].system.mount_shared_folder(ssh, name, data[:guestpath])
|
||||
else
|
||||
# If no guest path is specified, then automounting is disabled
|
||||
@env.ui.info(I18n.t("vagrant.actions.vm.share_folders.nomount_entry",
|
||||
:name => name))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -24,9 +24,9 @@ module Vagrant
|
|||
begin
|
||||
# Call the next middleware in the sequence, appending to the stack
|
||||
# of "recoverable" middlewares in case something goes wrong!
|
||||
raise Errors::VagrantInterrupt.new if env.interrupted?
|
||||
raise Errors::VagrantInterrupt if env.interrupted?
|
||||
@stack.unshift(@actions.shift).first.call(env)
|
||||
raise Errors::VagrantInterrupt.new if env.interrupted?
|
||||
raise Errors::VagrantInterrupt if env.interrupted?
|
||||
rescue SystemExit
|
||||
# This means that an "exit" or "abort" was called. In these cases,
|
||||
# we just exit immediately.
|
||||
|
|
|
@ -57,7 +57,7 @@ module Vagrant
|
|||
# method requires that `name` and `uri` be set. The logic of this method
|
||||
# is kicked out to the `box_add` registered middleware.
|
||||
def add
|
||||
raise Errors::BoxAlreadyExists.new(:name => name) if File.directory?(directory)
|
||||
raise Errors::BoxAlreadyExists, :name => name if File.directory?(directory)
|
||||
env.actions.run(:box_add, { "box" => self, "validate" => false })
|
||||
end
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@ module Vagrant
|
|||
desc "remove NAME", "Remove a box from the system"
|
||||
def remove(name)
|
||||
b = env.boxes.find(name)
|
||||
raise Errors::BoxNotFound.new(:name => name) if !b
|
||||
raise Errors::BoxNotFound, :name => name if !b
|
||||
b.destroy
|
||||
end
|
||||
|
||||
desc "repackage NAME", "Repackage an installed box into a `.box` file."
|
||||
def repackage(name)
|
||||
b = env.boxes.find(name)
|
||||
raise Errors::BoxNotFound.new(:name => name) if !b
|
||||
raise Errors::BoxNotFound, :name => name if !b
|
||||
b.repackage
|
||||
end
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ module Vagrant
|
|||
# Initializes the environment by pulling the environment out of
|
||||
# the configuration hash and sets up the UI if necessary.
|
||||
def initialize_environment(args, options, config)
|
||||
raise Errors::CLIMissingEnvironment.new if !config[:env]
|
||||
raise Errors::CLIMissingEnvironment if !config[:env]
|
||||
@env = config[:env]
|
||||
end
|
||||
|
||||
# This returns an array of {VM} objects depending on the arguments
|
||||
# given to the command.
|
||||
def target_vms(name=nil)
|
||||
raise Errors::NoEnvironmentError.new if !env.root_path
|
||||
raise Errors::NoEnvironmentError if !env.root_path
|
||||
|
||||
name ||= self.name rescue nil
|
||||
|
||||
|
@ -19,9 +19,9 @@ module Vagrant
|
|||
if env.multivm?
|
||||
return env.vms_ordered if !name
|
||||
vm = env.vms[name.to_sym]
|
||||
raise Errors::VMNotFoundError.new(:name => name) if !vm
|
||||
raise Errors::VMNotFoundError, :name => name if !vm
|
||||
else
|
||||
raise Errors::MultiVMEnvironmentRequired.new if name
|
||||
raise Errors::MultiVMEnvironmentRequired if name
|
||||
vm = env.vms.values.first
|
||||
end
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@ module Vagrant
|
|||
|
||||
def package_base
|
||||
vm = VM.find(options[:base], env)
|
||||
raise Errors::BaseVMNotFound.new(:name => options[:base]) if !vm.created?
|
||||
raise Errors::BaseVMNotFound, :name => options[:base] if !vm.created?
|
||||
package_vm(vm)
|
||||
end
|
||||
|
||||
def package_target
|
||||
raise Errors::MultiVMTargetRequired.new(:command => "package") if target_vms.length > 1
|
||||
raise Errors::MultiVMTargetRequired, :command => "package" if target_vms.length > 1
|
||||
vm = target_vms.first
|
||||
raise Errors::VMNotCreatedError.new if !vm.created?
|
||||
raise Errors::VMNotCreatedError if !vm.created?
|
||||
package_vm(vm)
|
||||
end
|
||||
|
||||
|
|
|
@ -24,15 +24,15 @@ module Vagrant
|
|||
end
|
||||
|
||||
def ssh_connect
|
||||
raise Errors::VMNotCreatedError.new if !ssh_vm.created?
|
||||
raise Errors::VMNotRunningError.new if !ssh_vm.vm.running?
|
||||
raise Errors::VMNotCreatedError if !ssh_vm.created?
|
||||
raise Errors::VMNotRunningError if !ssh_vm.vm.running?
|
||||
ssh_vm.ssh.connect
|
||||
end
|
||||
|
||||
def ssh_vm
|
||||
@ssh_vm ||= begin
|
||||
vm = self.name.nil? && env.multivm? ? env.primary_vm : nil
|
||||
raise Errors::MultiVMTargetRequired.new(:command => "ssh") if !vm && target_vms.length > 1
|
||||
raise Errors::MultiVMTargetRequired, :command => "ssh" if !vm && target_vms.length > 1
|
||||
vm = target_vms.first if !vm
|
||||
vm
|
||||
end
|
||||
|
|
|
@ -5,9 +5,9 @@ module Vagrant
|
|||
register "ssh_config", "outputs .ssh/config valid syntax for connecting to this environment via ssh"
|
||||
|
||||
def execute
|
||||
raise Errors::MultiVMTargetRequired.new(:command => "ssh_config") if target_vms.length > 1
|
||||
raise Errors::MultiVMTargetRequired, :command => "ssh_config" if target_vms.length > 1
|
||||
vm = target_vms.first
|
||||
raise Errors::VMNotCreatedError.new if !vm.created?
|
||||
raise Errors::VMNotCreatedError if !vm.created?
|
||||
|
||||
$stdout.puts(Util::TemplateRenderer.render("ssh_config", {
|
||||
:host_key => options[:host] || "vagrant",
|
||||
|
|
|
@ -95,7 +95,7 @@ module Vagrant
|
|||
load item
|
||||
rescue SyntaxError => e
|
||||
# Report syntax errors in a nice way for Vagrantfiles
|
||||
raise Errors::VagrantfileSyntaxError.new(:file => e.message)
|
||||
raise Errors::VagrantfileSyntaxError, :file => e.message
|
||||
end
|
||||
elsif item.is_a?(Proc)
|
||||
self.class.run(&item)
|
||||
|
@ -159,7 +159,7 @@ module Vagrant
|
|||
end
|
||||
|
||||
return if errors.empty?
|
||||
raise Errors::ConfigValidationFailed.new(:messages => Util::TemplateRenderer.render("config/validation_failed", :errors => errors))
|
||||
raise Errors::ConfigValidationFailed, :messages => Util::TemplateRenderer.render("config/validation_failed", :errors => errors)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -10,10 +10,11 @@ module Vagrant
|
|||
end
|
||||
|
||||
def prepare(source_url)
|
||||
raise Errors::DownloaderFileDoesntExist.new if !::File.file?(source_url)
|
||||
raise Errors::DownloaderFileDoesntExist if !::File.file?(source_url)
|
||||
end
|
||||
|
||||
def download!(source_url, destination_file)
|
||||
env.ui.info I18n.t("vagrant.downloaders.file.download")
|
||||
FileUtils.cp(source_url, destination_file.path)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,16 @@ module Vagrant
|
|||
end
|
||||
|
||||
http.start do |h|
|
||||
env.ui.info I18n.t("vagrant.downloaders.http.download", :url => source_url)
|
||||
|
||||
h.request_get(uri.request_uri) do |response|
|
||||
if response.is_a?(Net::HTTPRedirection)
|
||||
# Follow the HTTP redirect.
|
||||
# TODO: Error on some redirect limit
|
||||
download!(response["Location"], destination_file)
|
||||
return
|
||||
end
|
||||
|
||||
total = response.content_length
|
||||
progress = 0
|
||||
segment_count = 0
|
||||
|
@ -48,7 +57,7 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
rescue SocketError
|
||||
raise Errors::DownloaderHTTPSocketError.new
|
||||
raise Errors::DownloaderHTTPSocketError
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,9 +31,9 @@ module Vagrant
|
|||
# VirtualBox installed is high enough.
|
||||
def check_virtualbox!
|
||||
version = VirtualBox.version
|
||||
raise Errors::VirtualBoxNotDetected.new if version.nil?
|
||||
raise Errors::VirtualBoxInvalidVersion.new(:version => version.to_s) if version.to_f < 3.2
|
||||
raise Errors::VirtualBoxInvalidOSE.new(:version => version.to_s) if version.to_s.downcase.include?("ose")
|
||||
raise Errors::VirtualBoxNotDetected if version.nil?
|
||||
raise Errors::VirtualBoxInvalidVersion, :version => version.to_s if version.to_f < 4.0
|
||||
raise Errors::VirtualBoxInvalidOSE, :version => version.to_s if version.to_s.downcase.include?("ose")
|
||||
rescue Errors::VirtualBoxNotDetected
|
||||
# On 64-bit Windows, show a special error. This error is a subclass
|
||||
# of VirtualBoxNotDetected, so libraries which use Vagrant can just
|
||||
|
@ -305,6 +305,13 @@ module Vagrant
|
|||
self
|
||||
end
|
||||
|
||||
# Reloads the configuration of this environment.
|
||||
def reload_config!
|
||||
@config = nil
|
||||
load_config!
|
||||
self
|
||||
end
|
||||
|
||||
# Loads this environment's configuration and stores it in the {#config}
|
||||
# variable. The configuration loaded by this method is specified to
|
||||
# this environment, meaning that it will use the given root directory
|
||||
|
|
|
@ -183,6 +183,13 @@ module Vagrant
|
|||
error_key(:not_found, "vagrant.actions.vm.network")
|
||||
end
|
||||
|
||||
# Note: This is a temporary error for Windows users while host-only
|
||||
# networking doesn't quite work.
|
||||
class NetworkNotImplemented < VagrantError
|
||||
status_code(49)
|
||||
error_key(:windows_not_implemented, "vagrant.actions.vm.network")
|
||||
end
|
||||
|
||||
class NFSHostRequired < VagrantError
|
||||
status_code(31)
|
||||
error_key(:host_required, "vagrant.actions.vm.nfs")
|
||||
|
|
|
@ -5,7 +5,7 @@ module Vagrant
|
|||
# provisioner**. Instead, {ChefSolo} or {ChefServer} should be used.
|
||||
class Chef < Base
|
||||
def prepare
|
||||
raise ChefError.new(:invalid_provisioner)
|
||||
raise ChefError, :invalid_provisioner
|
||||
end
|
||||
|
||||
def verify_binary(binary)
|
||||
|
|
|
@ -6,9 +6,9 @@ module Vagrant
|
|||
# with a chef server.
|
||||
class ChefServer < Chef
|
||||
def prepare
|
||||
raise ChefError.new(:server_validation_key_required) if env.config.chef.validation_key_path.nil?
|
||||
raise ChefError.new(:server_validation_key_doesnt_exist) if !File.file?(validation_key_path)
|
||||
raise ChefError.new(:server_url_required) if env.config.chef.chef_server_url.nil?
|
||||
raise ChefError, :server_validation_key_required if env.config.chef.validation_key_path.nil?
|
||||
raise ChefError, :server_validation_key_doesnt_exist if !File.file?(validation_key_path)
|
||||
raise ChefError, :server_url_required if env.config.chef.chef_server_url.nil?
|
||||
end
|
||||
|
||||
def provision!
|
||||
|
|
|
@ -22,7 +22,6 @@ module Vagrant
|
|||
end
|
||||
|
||||
class Puppet < Base
|
||||
|
||||
def prepare
|
||||
check_manifest_dir
|
||||
share_manifests
|
||||
|
@ -63,7 +62,7 @@ module Vagrant
|
|||
env.ui.info I18n.t("vagrant.provisioners.puppet.manifest_to_run", :manifest => @manifest)
|
||||
return @manifest
|
||||
else
|
||||
raise PuppetError.new(:_key => :manifest_missing, :manifest => @manifest)
|
||||
raise PuppetError, :_key => :manifest_missing, :manifest => @manifest
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -81,7 +80,6 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,11 +23,11 @@ module Vagrant
|
|||
# of options which override the configuration values.
|
||||
def connect(opts={})
|
||||
if Mario::Platform.windows?
|
||||
raise Errors::SSHUnavailableWindows.new(:key_path => env.config.ssh.private_key_path,
|
||||
:ssh_port => port(opts))
|
||||
raise Errors::SSHUnavailableWindows, :key_path => env.config.ssh.private_key_path,
|
||||
:ssh_port => port(opts)
|
||||
end
|
||||
|
||||
raise Errors::SSHUnavailable.new if !Kernel.system("which ssh > /dev/null 2>&1")
|
||||
raise Errors::SSHUnavailable if !Kernel.system("which ssh > /dev/null 2>&1")
|
||||
|
||||
options = {}
|
||||
options[:port] = port(opts)
|
||||
|
@ -74,7 +74,7 @@ module Vagrant
|
|||
end
|
||||
end
|
||||
rescue Errno::ECONNREFUSED
|
||||
raise Errors::SSHConnectionRefused.new
|
||||
raise Errors::SSHConnectionRefused
|
||||
end
|
||||
|
||||
# Uploads a file from `from` to `to`. `from` is expected to be a filename
|
||||
|
@ -105,7 +105,7 @@ module Vagrant
|
|||
|
||||
true
|
||||
rescue Net::SSH::AuthenticationFailed
|
||||
raise Errors::SSHAuthenticationFailed.new
|
||||
raise Errors::SSHAuthenticationFailed
|
||||
rescue Timeout::Error, Errno::ECONNREFUSED, Net::SSH::Disconnect,
|
||||
Errors::SSHConnectionRefused, Net::SSH::AuthenticationFailed
|
||||
return false
|
||||
|
@ -122,12 +122,12 @@ module Vagrant
|
|||
if stat.owned? && file_perms(key_path) != "600"
|
||||
File.chmod(0600, key_path)
|
||||
|
||||
raise Errors::SSHKeyBadPermissions.new(:key_path => key_path) if file_perms(key_path) != "600"
|
||||
raise Errors::SSHKeyBadPermissions, :key_path => key_path if file_perms(key_path) != "600"
|
||||
end
|
||||
rescue Errno::EPERM
|
||||
# This shouldn't happen since we verify we own the file, but just
|
||||
# in case.
|
||||
raise Errors::SSHKeyBadPermissions.new(:key_path => key_path)
|
||||
raise Errors::SSHKeyBadPermissions, :key_path => key_path
|
||||
end
|
||||
|
||||
# Returns the file permissions of a given file. This is fairly unix specific
|
||||
|
@ -229,7 +229,7 @@ module Vagrant
|
|||
:command => command
|
||||
}.merge(options || {})
|
||||
|
||||
raise options[:_error_class].new(options)
|
||||
raise options[:_error_class], options
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -104,8 +104,8 @@ module Vagrant
|
|||
def mount_folder(ssh, name, guestpath, sleeptime=5)
|
||||
# Determine the permission string to attach to the mount command
|
||||
perms = []
|
||||
perms << "uid=#{vm.env.config.vm.shared_folder_uid}"
|
||||
perms << "gid=#{vm.env.config.vm.shared_folder_gid}"
|
||||
perms << "uid=`id -u #{vm.env.config.vm.shared_folder_uid}`"
|
||||
perms << "gid=`id -g #{vm.env.config.vm.shared_folder_gid}`"
|
||||
perms = " -o #{perms.join(",")}" if !perms.empty?
|
||||
|
||||
attempts = 0
|
||||
|
@ -118,7 +118,7 @@ module Vagrant
|
|||
break unless result
|
||||
|
||||
attempts += 1
|
||||
raise LinuxError.new(:mount_fail) if attempts >= 10
|
||||
raise LinuxError, :mount_fail if attempts >= 10
|
||||
sleep sleeptime
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,5 +2,5 @@ module Vagrant
|
|||
# This will always be up to date with the current version of Vagrant,
|
||||
# since it is used to generate the gemspec and is also the source of
|
||||
# the version for `vagrant -v`
|
||||
VERSION = "0.6.9.dev"
|
||||
VERSION = "0.7.0.beta2.dev"
|
||||
end
|
||||
|
|
|
@ -53,15 +53,15 @@ module Vagrant
|
|||
|
||||
if system.is_a?(Class)
|
||||
@system = system.new(self)
|
||||
raise Errors::VMSystemError.new(:_key => :invalid_class, :system => system.to_s) if !@system.is_a?(Systems::Base)
|
||||
raise Errors::VMSystemError, :_key => :invalid_class, :system => system.to_s if !@system.is_a?(Systems::Base)
|
||||
elsif system.is_a?(Symbol)
|
||||
# Hard-coded internal systems
|
||||
mapping = { :linux => Systems::Linux, :solaris => Systems::Solaris }
|
||||
|
||||
raise Errors::VMSystemError.new(:_key => :unknown_type, :system => system.to_s) if !mapping.has_key?(system)
|
||||
raise Errors::VMSystemError, :_key => :unknown_type, :system => system.to_s if !mapping.has_key?(system)
|
||||
@system = mapping[system].new(self)
|
||||
else
|
||||
raise Errors::VMSystemError.new(:unspecified)
|
||||
raise Errors::VMSystemError, :unspecified
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -96,8 +96,13 @@ en:
|
|||
to continue.
|
||||
virtualbox_invalid_version: |-
|
||||
Vagrant has detected that you have VirtualBox version %{version} installed!
|
||||
Vagrant requires that you use at least VirtualBox version 3.2. Please install
|
||||
Vagrant requires that you use at least VirtualBox version 4.0. Please install
|
||||
a more recent version of VirtualBox to continue.
|
||||
|
||||
The Vagrant 0.6.x series supports VirtualBox 3.2, so if you're stuck with that
|
||||
version, then please use the 0.6.x series of Vagrant.
|
||||
|
||||
Any earlier versions of VirtualBox are completely unsupported. Please upgrade.
|
||||
virtualbox_not_detected: |-
|
||||
Vagrant could not detect VirtualBox! Make sure VirtualBox is properly installed.
|
||||
If VirtualBox is installed, it may be an incorrect version. Vagrant currently
|
||||
|
@ -304,14 +309,19 @@ en:
|
|||
This will cause your specified IP to be inaccessible. Please change
|
||||
the IP or name of your host only network to not match that of
|
||||
a bridged or non-hostonly network.
|
||||
creating: Creating new host only network for environment...
|
||||
enabling: Enabling host only network...
|
||||
creating: "Creating new host only network for environment..."
|
||||
enabling: "Enabling host only network..."
|
||||
not_found: |-
|
||||
The specified host network could not be found: '%{name}.'
|
||||
If the name specification is removed, Vagrant will create a new
|
||||
host only network for you. Alternatively, please create the
|
||||
specified network manually.
|
||||
preparing: Preparing host only network...
|
||||
preparing: "Preparing host only network..."
|
||||
windows_not_implemented: |-
|
||||
Host only networking is currently broken on Windows due to a bug
|
||||
in jruby-win32ole. When the bug is fixed, a patch release for Vagrant
|
||||
will be released to remove this error. Until then, please just use
|
||||
forwarded ports.
|
||||
nfs:
|
||||
host_required: |-
|
||||
A host class is required for NFS shared folders. By default, these
|
||||
|
@ -351,6 +361,7 @@ en:
|
|||
creating: Creating shared folders metadata...
|
||||
mounting: Mounting shared folders...
|
||||
mounting_entry: "-- %{name}: %{guest_path}"
|
||||
nomount_entry: "-- %{name}: Automounting disabled."
|
||||
suspend:
|
||||
suspending: Saving VM state and suspending execution...
|
||||
|
||||
|
@ -360,7 +371,6 @@ en:
|
|||
download:
|
||||
with: "Downloading with %{class}..."
|
||||
cleaning: "Cleaning up downloaded box..."
|
||||
copying: "Copying box to temporary location..."
|
||||
unknown_type: "Unknown or unsupported URI type given for box download."
|
||||
unpackage:
|
||||
extracting: "Extracting box..."
|
||||
|
@ -391,8 +401,10 @@ en:
|
|||
|
||||
downloaders:
|
||||
file:
|
||||
download: "Copying box to temporary location..."
|
||||
file_missing: "The specified path to a file doesn't exist."
|
||||
http:
|
||||
download: "Downloading box: %{url}"
|
||||
socket_error: |-
|
||||
An error occurred while trying to download the specified box. This most
|
||||
often happens if there is no internet connection or the address is
|
||||
|
|
|
@ -45,6 +45,7 @@ class CheckBoxVMActionTest < Test::Unit::TestCase
|
|||
env.env.boxes.expects(:find).returns(nil)
|
||||
Vagrant::Box.expects(:add).with(env.env, env["config"].vm.box, env["config"].vm.box_url).in_sequence(seq)
|
||||
env.env.boxes.expects(:reload!).in_sequence(seq)
|
||||
env.env.expects(:reload_config!).in_sequence(seq)
|
||||
app.expects(:call).with(env).once.in_sequence(seq)
|
||||
|
||||
assert_nothing_raised {
|
||||
|
|
|
@ -37,10 +37,10 @@ class CleanMachineFolderVMActionTest < Test::Unit::TestCase
|
|||
@instance.clean_machine_folder
|
||||
end
|
||||
|
||||
should "delete directories with only .xml-prev files" do
|
||||
should "delete directories with only .vbox-prev files" do
|
||||
folders = {
|
||||
"sfoo" => %W[foo bar baz.xml-prev],
|
||||
"sbar" => %W[foo.xml-prev]
|
||||
"sfoo" => %W[foo bar baz.vbox-prev],
|
||||
"sbar" => %W[foo.vbox-prev]
|
||||
}
|
||||
|
||||
Dir.expects(:[]).with(@folder).returns(folders.keys)
|
||||
|
@ -57,7 +57,7 @@ class CleanMachineFolderVMActionTest < Test::Unit::TestCase
|
|||
should "delete directories with only subdirectories" do
|
||||
folders = {
|
||||
"sfoo" => %W[foo bar],
|
||||
"sbar" => %W[foo.xml-prev]
|
||||
"sbar" => %W[foo.vbox-prev]
|
||||
}
|
||||
|
||||
File.stubs(:file?).returns(false)
|
||||
|
@ -77,6 +77,8 @@ class CleanMachineFolderVMActionTest < Test::Unit::TestCase
|
|||
should "do nothing if folder is < 10 characters" do
|
||||
VirtualBox::Global.global.system_properties.stubs(:default_machine_folder).returns("foo")
|
||||
Dir.expects(:[]).never
|
||||
|
||||
@instance.clean_machine_folder
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ class DestroyVMActionTest < Test::Unit::TestCase
|
|||
|
||||
context "destroying the VM" do
|
||||
should "destroy VM and attached images" do
|
||||
@internal_vm.expects(:destroy).with(:destroy_medium => :delete).once
|
||||
@internal_vm.expects(:destroy).once
|
||||
@env["vm"].expects(:vm=).with(nil).once
|
||||
@app.expects(:call).with(@env).once
|
||||
@instance.call(@env)
|
||||
|
|
|
@ -16,24 +16,27 @@ class DestroyUnusedNetworkInterfacesVMActionTest < Test::Unit::TestCase
|
|||
|
||||
context "calling" do
|
||||
setup do
|
||||
@network_adapters = []
|
||||
@internal_vm.stubs(:network_adapters).returns(@network_adapters)
|
||||
@interfaces = []
|
||||
global = mock("global")
|
||||
host = mock("host")
|
||||
VirtualBox::Global.stubs(:global).returns(global)
|
||||
global.stubs(:host).returns(host)
|
||||
host.stubs(:network_interfaces).returns(@interfaces)
|
||||
end
|
||||
|
||||
def stub_interface(length=5)
|
||||
def stub_interface(length=5, type=:host_only)
|
||||
interface = mock("interface")
|
||||
adapter = mock("adapter")
|
||||
adapter.stubs(:host_interface_object).returns(interface)
|
||||
interface.stubs(:interface_type).returns(type)
|
||||
interface.stubs(:attached_vms).returns(Array.new(length))
|
||||
|
||||
@network_adapters << adapter
|
||||
@interfaces << interface
|
||||
interface
|
||||
end
|
||||
|
||||
should "destroy only the unused network interfaces" do
|
||||
stub_interface(5)
|
||||
stub_interface(7)
|
||||
results = [stub_interface(1), stub_interface(1)]
|
||||
results = [stub_interface(0), stub_interface(0)]
|
||||
|
||||
results.each do |result|
|
||||
result.expects(:destroy).once
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
require "test_helper"
|
||||
|
||||
class DisableNetworksVMActionTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Action::VM::DisableNetworks
|
||||
@app, @env = action_env
|
||||
|
||||
@vm = mock("vm")
|
||||
@env.env.stubs(:vm).returns(@vm)
|
||||
|
||||
@internal_vm = mock("internal")
|
||||
@vm.stubs(:created?).returns(true)
|
||||
@vm.stubs(:vm).returns(@internal_vm)
|
||||
@internal_vm.stubs(:network_adapters).returns([])
|
||||
|
||||
@instance = @klass.new(@app, @env)
|
||||
end
|
||||
|
||||
def mock_adapter(type)
|
||||
adapter = mock("adapter")
|
||||
adapter.stubs(:attachment_type).returns(type)
|
||||
|
||||
if type == :host_only
|
||||
adapter.expects(:enabled=).with(false)
|
||||
adapter.expects(:save)
|
||||
end
|
||||
|
||||
@internal_vm.network_adapters << adapter
|
||||
end
|
||||
|
||||
should "do nothing if VM is not created" do
|
||||
@vm.stubs(:created?).returns(false)
|
||||
@vm.expects(:vm).never
|
||||
|
||||
@app.expects(:call).with(@env).once
|
||||
@instance.call(@env)
|
||||
end
|
||||
|
||||
should "remove all network adapters and continue chain" do
|
||||
mock_adapter(:bridged)
|
||||
mock_adapter(:host_only)
|
||||
mock_adapter(:host_only)
|
||||
|
||||
@app.expects(:call).with(@env).once
|
||||
|
||||
@instance.call(@env)
|
||||
end
|
||||
end
|
|
@ -16,6 +16,24 @@ class NetworkVMActionTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
context "initializing" do
|
||||
should "raise an error if on windows and networking is enabled" do
|
||||
Vagrant::Util::Platform.stubs(:windows?).returns(true)
|
||||
@env.env.config.vm.network("foo")
|
||||
|
||||
assert_raises(Vagrant::Errors::NetworkNotImplemented) {
|
||||
@klass.new(@app, @env)
|
||||
}
|
||||
end
|
||||
|
||||
should "not raise an error if not on windows and networking is enabled" do
|
||||
Vagrant::Util::Platform.stubs(:windows?).returns(false)
|
||||
@env.env.config.vm.network("foo")
|
||||
|
||||
assert_nothing_raised {
|
||||
@klass.new(@app, @env)
|
||||
}
|
||||
end
|
||||
|
||||
should "verify no bridge collisions for each network enabled" do
|
||||
@env.env.config.vm.network("foo")
|
||||
@klass.any_instance.expects(:verify_no_bridge_collision).returns(true).once.with() do |options|
|
||||
|
|
|
@ -160,13 +160,19 @@ class NFSVMActionTest < Test::Unit::TestCase
|
|||
context "mounting folders" do
|
||||
setup do
|
||||
@instance.stubs(:host_ip).returns("foo")
|
||||
@instance.stubs(:folders).returns(["bar"])
|
||||
@instance.stubs(:folders).returns([{:guestpath => "foo"}])
|
||||
end
|
||||
|
||||
should "mount the folders on the system" do
|
||||
@vm.system.expects(:mount_nfs).with(@instance.host_ip, @instance.folders)
|
||||
@instance.mount_folders
|
||||
end
|
||||
|
||||
should "not mount folders which have no guest path" do
|
||||
@instance.stubs(:folders).returns([{}])
|
||||
@vm.system.expects(:mount_nfs).with(@instance.host_ip, [])
|
||||
@instance.mount_folders
|
||||
end
|
||||
end
|
||||
|
||||
context "getting the host IP" do
|
||||
|
|
|
@ -116,6 +116,7 @@ class ShareFoldersVMActionTest < Test::Unit::TestCase
|
|||
@folders = stub_shared_folders(<<-sf)
|
||||
config.vm.share_folder("foo", "fooguest", "foohost")
|
||||
config.vm.share_folder("bar", "barguest", "barhost")
|
||||
config.vm.share_folder("foo_no_mount", nil, "foohost2")
|
||||
sf
|
||||
@ssh = mock("ssh")
|
||||
@vm.ssh.stubs(:execute).yields(@ssh)
|
||||
|
@ -125,7 +126,11 @@ class ShareFoldersVMActionTest < Test::Unit::TestCase
|
|||
should "mount all shared folders to the VM" do
|
||||
mount_seq = sequence("mount_seq")
|
||||
@folders.each do |name, data|
|
||||
@vm.system.expects(:mount_shared_folder).with(@ssh, name, data[:guestpath]).in_sequence(mount_seq)
|
||||
if data[:guestpath]
|
||||
@vm.system.expects(:mount_shared_folder).with(@ssh, name, data[:guestpath]).in_sequence(mount_seq)
|
||||
else
|
||||
@vm.system.expects(:mount_shared_folder).with(@ssh, name, anything).never
|
||||
end
|
||||
end
|
||||
|
||||
@instance.mount_shared_folders
|
||||
|
|
|
@ -17,11 +17,25 @@ class FileDownloaderTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
context "downloading" do
|
||||
setup do
|
||||
clean_paths
|
||||
end
|
||||
|
||||
should "cp the file" do
|
||||
path = '/path'
|
||||
@tempfile.expects(:path).returns(path)
|
||||
FileUtils.expects(:cp).with(@uri, path)
|
||||
@downloader.download!(@uri, @tempfile)
|
||||
uri = tmp_path.join("foo_source")
|
||||
dest = tmp_path.join("foo_dest")
|
||||
|
||||
# Create the source file, then "download" it
|
||||
File.open(uri, "w+") { |f| f.write("FOO") }
|
||||
File.open(dest, "w+") do |dest_file|
|
||||
@downloader.download!(uri, dest_file)
|
||||
end
|
||||
|
||||
# Finally, verify the destination file was properly created
|
||||
assert File.file?(dest)
|
||||
File.open(dest) do |f|
|
||||
assert_equal "FOO", f.read
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -8,11 +8,11 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
|
||||
context "class method check virtualbox version" do
|
||||
setup do
|
||||
VirtualBox.stubs(:version).returns("3.1.4")
|
||||
VirtualBox.stubs(:version).returns("4.0.0")
|
||||
end
|
||||
|
||||
should "not error and exit if everything is good" do
|
||||
VirtualBox.expects(:version).returns("3.2.4")
|
||||
VirtualBox.expects(:version).returns("4.0.0")
|
||||
assert_nothing_raised { @klass.check_virtualbox! }
|
||||
end
|
||||
|
||||
|
@ -21,14 +21,14 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
assert_raises(Vagrant::Errors::VirtualBoxNotDetected) { @klass.check_virtualbox! }
|
||||
end
|
||||
|
||||
should "error and exit if VirtualBox is lower than version 3.2" do
|
||||
version = "3.1.12r1041"
|
||||
should "error and exit if VirtualBox is lower than version 4.0" do
|
||||
version = "3.2.12r1041"
|
||||
VirtualBox.expects(:version).returns(version)
|
||||
assert_raises(Vagrant::Errors::VirtualBoxInvalidVersion) { @klass.check_virtualbox! }
|
||||
end
|
||||
|
||||
should "error and exit for OSE VirtualBox" do
|
||||
version = "3.2.6_OSE"
|
||||
version = "4.0.0_OSE"
|
||||
VirtualBox.expects(:version).returns(version)
|
||||
assert_raises(Vagrant::Errors::VirtualBoxInvalidOSE) { @klass.check_virtualbox! }
|
||||
end
|
||||
|
@ -425,6 +425,21 @@ class EnvironmentTest < Test::Unit::TestCase
|
|||
@env.load_config!
|
||||
assert @env.instance_variable_get(:@logger).nil?
|
||||
end
|
||||
|
||||
should "be able to reload config" do
|
||||
vagrantfile(@env.root_path, "config.vm.box = 'box'")
|
||||
|
||||
# First load the config normally
|
||||
@env.load_config!
|
||||
assert_equal "box", @env.config.vm.box
|
||||
assert_not_equal "set", @env.config.vm.base_mac
|
||||
|
||||
# Modify the Vagrantfile and reload it, then verify new results
|
||||
# are available
|
||||
vagrantfile(@env.root_path, "config.vm.base_mac = 'set'")
|
||||
@env.reload_config!
|
||||
assert_equal "set", @env.config.vm.base_mac
|
||||
end
|
||||
end
|
||||
|
||||
context "loading home directory" do
|
||||
|
|
|
@ -12,7 +12,7 @@ class SshTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
setup do
|
||||
VirtualBox.stubs(:version).returns("3.2.4")
|
||||
VirtualBox.stubs(:version).returns("4.0.0")
|
||||
end
|
||||
|
||||
context "connecting to external SSH" do
|
||||
|
|
|
@ -61,7 +61,7 @@ class LinuxSystemTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
should "execute the proper mount command" do
|
||||
@ssh.expects(:exec!).with("sudo mount -t vboxsf -o uid=#{@vm.env.config.ssh.username},gid=#{@vm.env.config.ssh.username} #{@name} #{@guestpath}").returns(@success_return)
|
||||
@ssh.expects(:exec!).with("sudo mount -t vboxsf -o uid=`id -u #{@vm.env.config.ssh.username}`,gid=`id -g #{@vm.env.config.ssh.username}` #{@name} #{@guestpath}").returns(@success_return)
|
||||
mount_folder
|
||||
end
|
||||
|
||||
|
@ -107,7 +107,7 @@ class LinuxSystemTest < Test::Unit::TestCase
|
|||
|
||||
@vm.stubs(:env).returns(env)
|
||||
|
||||
@ssh.expects(:exec!).with("sudo mount -t vboxsf -o uid=#{uid},gid=#{gid} #{@name} #{@guestpath}").returns(@success_return)
|
||||
@ssh.expects(:exec!).with("sudo mount -t vboxsf -o uid=`id -u #{uid}`,gid=`id -g #{gid}` #{@name} #{@guestpath}").returns(@success_return)
|
||||
mount_folder
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ Gem::Specification.new do |s|
|
|||
s.add_dependency "net-scp", "~> 1.0.3"
|
||||
s.add_dependency "i18n", "~> 0.4.1"
|
||||
s.add_dependency "thor", "~> 0.14.2"
|
||||
s.add_dependency "virtualbox", "~> 0.7.6"
|
||||
s.add_dependency "virtualbox", "~> 0.8.0"
|
||||
|
||||
s.add_development_dependency "rake"
|
||||
s.add_development_dependency "contest", ">= 0.1.2"
|
||||
|
|
Loading…
Reference in New Issue