Sha256: c8b5941906ae8429be4f3f561fe3257ceef3c2430b177227d892d907cb07a9ac

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

module Vagrant
  module Actions
    module VM
      class Up < Base
        def prepare
          # If the dotfile is not a file, raise error
          if File.exist?(@runner.env.dotfile_path) && !File.file?(@runner.env.dotfile_path)
            raise ActionException.new(:dotfile_error, :env => @runner.env)
          end

          # Up is a "meta-action" so it really just queues up a bunch
          # of other actions in its place:
          steps = [Import, Start]
          steps.insert(0, MoveHardDrive) if @runner.env.config.vm.hd_location

          steps.each do |action_klass|
            @runner.add_action(action_klass, options)
          end
        end

        def after_import
          update_dotfile
          setup_mac_address
        end

        def update_dotfile
          logger.info "Persisting the VM UUID (#{@runner.uuid})..."
          @runner.env.update_dotfile
        end

        def setup_mac_address
          logger.info "Matching MAC addresses..."
          @runner.vm.network_adapters.first.mac_address = @runner.env.config.vm.base_mac
          @runner.vm.save
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
vagrantup-0.4.0 lib/vagrant/actions/vm/up.rb
vagrant-0.4.0 lib/vagrant/actions/vm/up.rb