Sha256: 26112c67047f71fd69a5d34f0e54dc922e85431c0834af80287960a4ca4ac370

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

require "vagrant/util/template_renderer"

module Vagrant
  module Action
    module Builtin
      # This class validates the configuration and raises an exception
      # if there are any validation errors.
      class ConfigValidate
        def initialize(app, env)
          @app = app
        end

        def call(env)
          if !env.has_key?(:config_validate) || env[:config_validate]
            errors = env[:machine].config.validate(env[:machine])

            if errors && !errors.empty?
              raise Errors::ConfigInvalid,
                errors: Util::TemplateRenderer.render(
                  "config/validation_failed",
                  errors: errors)
            end
          end

          @app.call(env)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/bundler/gems/vagrant-1e28f1ac31e7/lib/vagrant/action/builtin/config_validate.rb