Sha256: 72c93ff3769d9f6fbd1bd0329a4ac5da1d7cdda1bf41ae0ed7a9df2df9b28c86

Contents?: true

Size: 1.07 KB

Versions: 58

Compression:

Stored size: 1.07 KB

Contents

require "log4r"

module Vagrant
  module Action
    module Builtin
      class PrepareClone
        def initialize(app, env)
          @app = app
          @logger = Log4r::Logger.new("vagrant::action::vm::prepare_clone")
        end

        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
      end
    end
  end
end

Version data entries

58 entries across 54 versions & 6 rubygems

Version Path
vagrant-unbundled-2.3.6.0 lib/vagrant/action/builtin/prepare_clone.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.3.3.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.3.2.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.19.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.18.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.16.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.14.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.10.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.9.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.8.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.7.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.6.2 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.6.1 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.6.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.5.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.4.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.3.0 lib/vagrant/action/builtin/prepare_clone.rb
vagrant-unbundled-2.2.2.0 lib/vagrant/action/builtin/prepare_clone.rb