Class: VagrantPlugins::R10k::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::R10k::Config
- Defined in:
- lib/vagrant-r10k/config.rb
Overview
vagrant-r10k plugin configuration
Instance Attribute Summary collapse
-
#module_path ⇒ Object
Returns the value of attribute module_path.
-
#puppet_dir ⇒ Object
Returns the value of attribute puppet_dir.
-
#puppetfile_path ⇒ Object
Returns the value of attribute puppetfile_path.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
initialize config.
-
#validate(machine) ⇒ Object
validate configuration.
Constructor Details
#initialize ⇒ Config
initialize config
12 13 14 15 16 17 18 |
# File 'lib/vagrant-r10k/config.rb', line 12 def initialize @puppet_dir = UNSET_VALUE @puppetfile_path = UNSET_VALUE @module_path = UNSET_VALUE @logger = Log4r::Logger.new("vagrant::r10k::config") @logger.debug("vagrant-r10k-config: initialize") end |
Instance Attribute Details
#module_path ⇒ Object
Returns the value of attribute module_path.
9 10 11 |
# File 'lib/vagrant-r10k/config.rb', line 9 def module_path @module_path end |
#puppet_dir ⇒ Object
Returns the value of attribute puppet_dir.
7 8 9 |
# File 'lib/vagrant-r10k/config.rb', line 7 def puppet_dir @puppet_dir end |
#puppetfile_path ⇒ Object
Returns the value of attribute puppetfile_path.
8 9 10 |
# File 'lib/vagrant-r10k/config.rb', line 8 def puppetfile_path @puppetfile_path end |
Instance Method Details
#validate(machine) ⇒ Object
validate configuration
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/vagrant-r10k/config.rb', line 21 def validate(machine) @logger.debug("vagrant-r10k-config: validate") errors = _detected_errors return {} if puppet_dir == UNSET_VALUE and puppetfile_path == UNSET_VALUE if puppet_dir == UNSET_VALUE errors << "config.r10k.puppet_dir must be set" return { "vagrant-r10k" => errors } end puppet_dir_path = File.join(machine.env.root_path, puppet_dir) errors << "puppet_dir directory '#{puppet_dir_path}' does not exist" unless File.directory?(puppet_dir_path) if puppetfile_path == UNSET_VALUE errors << "config.r10k.puppetfile_path must be set" return { "vagrant-r10k" => errors } end puppetfile = File.join(machine.env.root_path, puppetfile_path) errors << "puppetfile '#{puppetfile}' does not exist" unless File.file?(puppetfile) if module_path != UNSET_VALUE module_path_path = File.join(machine.env.root_path, module_path) errors << "module_path directory '#{module_path_path}' does not exist" unless File.directory?(module_path_path) end @logger.debug("vagrant-r10k-config: END validate") { "vagrant-r10k" => errors } end |