Sha256: 0610e53e86e81d6a4224caa37576503f2e52ff213a6ef952cfab4c62fe20a384

Contents?: true

Size: 1.06 KB

Versions: 8

Compression:

Stored size: 1.06 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 VirtualBox::Exceptions::FileErrorException
          raise ActionException.new(:box_verification_failed)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
vagrantup-0.3.4 lib/vagrant/actions/box/verify.rb
vagrantup-0.3.3 lib/vagrant/actions/box/verify.rb
vagrantup-0.3.2 lib/vagrant/actions/box/verify.rb
vagrantup-0.3.1 lib/vagrant/actions/box/verify.rb
vagrant-0.3.4 lib/vagrant/actions/box/verify.rb
vagrant-0.3.3 lib/vagrant/actions/box/verify.rb
vagrant-0.3.2 lib/vagrant/actions/box/verify.rb
vagrant-0.3.1 lib/vagrant/actions/box/verify.rb