Class: Vagrant::Action::Builtin::PrepareClone
- Inherits:
-
Object
- Object
- Vagrant::Action::Builtin::PrepareClone
- Defined in:
- lib/vagrant/action/builtin/prepare_clone.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, env) ⇒ PrepareClone
constructor
A new instance of PrepareClone.
Constructor Details
#initialize(app, env) ⇒ PrepareClone
Returns a new instance of PrepareClone.
10 11 12 13 |
# File 'lib/vagrant/action/builtin/prepare_clone.rb', line 10 def initialize(app, env) @app = app @logger = Log4r::Logger.new("vagrant::action::vm::prepare_clone") end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/vagrant/action/builtin/prepare_clone.rb', line 15 def call(env) # If we aren't cloning, then do nothing if !env[:machine].config.vm.clone return @app.call(env) end # We need to get the machine ID from this Vagrant environment clone_env = env[:machine].env.environment( env[:machine].config.vm.clone) raise Errors::CloneNotFound if !clone_env.root_path # Get the machine itself clone_machine = clone_env.machine( clone_env.primary_machine_name, env[:machine].provider_name) raise Errors::CloneMachineNotFound if !clone_machine.id # Set the ID of the master so we know what to clone from env[:clone_id] = clone_machine.id env[:clone_machine] = clone_machine # Continue @app.call(env) end |