Class: VagrantPlugins::PuppetModules::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::PuppetModules::Config
- Defined in:
- lib/vagrant-puppet-modules/config.rb
Instance Attribute Summary collapse
-
#install_url ⇒ Object
Returns the value of attribute install_url.
-
#librarian_version ⇒ Object
Returns the value of attribute librarian_version.
-
#puppetfile_dir ⇒ Object
Returns the value of attribute puppetfile_dir.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 15 |
# File 'lib/vagrant-puppet-modules/config.rb', line 10 def initialize @librarian_version = UNSET_VALUE @install_url = UNSET_VALUE @puppetfile_dir = UNSET_VALUE @logger = Log4r::Logger.new('vagrantplugins::puppet_modules::config') end |
Instance Attribute Details
#install_url ⇒ Object
Returns the value of attribute install_url.
8 9 10 |
# File 'lib/vagrant-puppet-modules/config.rb', line 8 def install_url @install_url end |
#librarian_version ⇒ Object
Returns the value of attribute librarian_version.
8 9 10 |
# File 'lib/vagrant-puppet-modules/config.rb', line 8 def librarian_version @librarian_version end |
#puppetfile_dir ⇒ Object
Returns the value of attribute puppetfile_dir.
8 9 10 |
# File 'lib/vagrant-puppet-modules/config.rb', line 8 def puppetfile_dir @puppetfile_dir end |
Instance Method Details
#finalize! ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vagrant-puppet-modules/config.rb', line 17 def finalize! if @librarian_version == UNSET_VALUE @librarian_version = nil elsif @librarian_version.to_s == 'latest' @librarian_version = retrieve_latest_librarian_version end @install_url = nil if @install_url == UNSET_VALUE @puppetfile_dir = nil if @puppetfile_dir == UNSET_VALUE end |
#validate! ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vagrant-puppet-modules/config.rb', line 28 def validate!() finalize! if !librarian_version.nil? && !valid_librarian_version?(librarian_version) errors = Vagrant::Util::TemplateRenderer.render( 'config/validation_failed', errors: { 'vagrant-puppet-modules' => [ "#{librarian_version} is not a valid version of librarian-puppet." ] } ) fail Vagrant::Errors::ConfigInvalid, errors: errors end end |