diff --git a/plugins/providers/virtualbox/action.rb b/plugins/providers/virtualbox/action.rb index a64782973..186f8debd 100644 --- a/plugins/providers/virtualbox/action.rb +++ b/plugins/providers/virtualbox/action.rb @@ -35,6 +35,7 @@ module VagrantPlugins autoload :NetworkFixIPv6, File.expand_path("../action/network_fix_ipv6", __FILE__) autoload :Package, File.expand_path("../action/package", __FILE__) autoload :PackageVagrantfile, File.expand_path("../action/package_vagrantfile", __FILE__) + autoload :PrepareClone, File.expand_path("../action/prepare_clone", __FILE__) autoload :PrepareNFSSettings, File.expand_path("../action/prepare_nfs_settings", __FILE__) autoload :PrepareNFSValidIds, File.expand_path("../action/prepare_nfs_valid_ids", __FILE__) autoload :PrepareForwardedPortCollisionParams, File.expand_path("../action/prepare_forwarded_port_collision_params", __FILE__) @@ -384,10 +385,16 @@ module VagrantPlugins b2.use CheckAccessible b2.use Customize, "pre-import" - if env[:machine].provider_config.linked_clone + if env[:machine].config.vm.clone + # We are cloning from another Vagrant environment + b2.use PrepareClone + b2.use CreateClone + elsif env[:machine].provider_config.linked_clone + # We are cloning from the box b2.use ImportMaster b2.use CreateClone else + # We are just doing a normal import from a box b2.use Import end diff --git a/plugins/providers/virtualbox/action/prepare_clone.rb b/plugins/providers/virtualbox/action/prepare_clone.rb new file mode 100644 index 000000000..e3451cfef --- /dev/null +++ b/plugins/providers/virtualbox/action/prepare_clone.rb @@ -0,0 +1,21 @@ +require "log4r" + +module VagrantPlugins + module ProviderVirtualBox + module Action + class PrepareClone + def initialize(app, env) + @app = app + @logger = Log4r::Logger.new("vagrant::action::vm::prepare_clone") + end + + def call(env) + # We need to get the machine ID from this Vagrant environment + + # Continue + @app.call(env) + end + end + end + end +end