Sha256: 4c5873b1511ba069c4e8467b243f1bc9ac526f6fb35597924bbb2351451f7d2c

Contents?: true

Size: 1.02 KB

Versions: 6

Compression:

Stored size: 1.02 KB

Contents

module Vagrant
  module Actions
    module Box
      # This action verifies that a given box is valid. This works by attempting
      # to read/interpret the appliance file (OVF). If the reading succeeds, then
      # the box is assumed to be valid.
      class Verify < Base
        def execute!
          logger.info "Verifying box..."
          reload_configuration
          verify_appliance
        end

        def reload_configuration
          # We have to reload the environment config since we _just_ added the
          # box. We do this by setting the current box to the recently added box,
          # then reloading
          @runner.env.config.vm.box = @runner.name
          @runner.env.load_box!
          @runner.env.load_config!
        end

        def verify_appliance
          # We now try to read the applince. If it succeeds, we return true.
          VirtualBox::Appliance.new(@runner.ovf_file)
        rescue Exception
          raise ActionException.new(:box_verification_failed)
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vagrantup-0.4.3.dev lib/vagrant/actions/box/verify.rb
vagrantup-0.4.1 lib/vagrant/actions/box/verify.rb
vagrantup-0.4.0 lib/vagrant/actions/box/verify.rb
vagrant-0.4.2 lib/vagrant/actions/box/verify.rb
vagrant-0.4.1 lib/vagrant/actions/box/verify.rb
vagrant-0.4.0 lib/vagrant/actions/box/verify.rb