Class: VagrantPlugins::R10k::Action::Validate
- Defined in:
- lib/vagrant-r10k/action/validate.rb
Overview
action to validate config pre-deploy
Instance Method Summary collapse
-
#call(env) ⇒ Object
validate configuration pre-deploy.
Methods inherited from Base
Methods included from Helpers
#env_dir, #get_puppetfile, #module_path, #provision_enabled?, #puppet_provisioner, #puppetfile_path, #r10k_config, #r10k_enabled?
Constructor Details
This class inherits a constructor from VagrantPlugins::R10k::Action::Base
Instance Method Details
#call(env) ⇒ Object
validate configuration pre-deploy
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vagrant-r10k/action/validate.rb', line 10 def call(env) @logger.debug "vagrant::r10k::validate called" unless r10k_enabled?(env) env[:ui].info "vagrant-r10k not configured; skipping" return @app.call(env) end unless provision_enabled?(env) env[:ui].info "provisioning disabled; skipping vagrant-r10k" return @app.call(env) end config = r10k_config(env) if config.nil? @logger.info "vagrant::r10k::deploy got nil configuration" raise ErrorWrapper.new(RuntimeError.new("vagrant-r10k configuration error; cannot continue")) end puppetfile = get_puppetfile(config) # validate puppetfile @logger.debug "vagrant::r10k::validate: validating Puppetfile at #{config[:puppetfile_path]}" begin puppetfile.load rescue Exception => ex @env[:ui].error "Invalid syntax in Puppetfile at #{config[:puppetfile_path]}" raise ErrorWrapper.new(ex) end @app.call(env) end |