Class: VagrantPlugins::PuppetInstall::Config
- Inherits:
-
Object
- Object
- VagrantPlugins::PuppetInstall::Config
- Defined in:
- lib/vagrant-puppet-install/config.rb
Instance Attribute Summary collapse
-
#install_url ⇒ Object
Returns the value of attribute install_url.
-
#puppet_version ⇒ Object
Returns the value of attribute puppet_version.
-
#validate_version ⇒ Object
Returns the value of attribute validate_version.
Instance Method Summary collapse
- #finalize! ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #validate!(_machine) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
10 11 12 13 14 15 |
# File 'lib/vagrant-puppet-install/config.rb', line 10 def initialize @puppet_version = UNSET_VALUE @install_url = UNSET_VALUE @validate_version = UNSET_VALUE @logger = Log4r::Logger.new('vagrantplugins::puppet_install::config') end |
Instance Attribute Details
#install_url ⇒ Object
Returns the value of attribute install_url.
8 9 10 |
# File 'lib/vagrant-puppet-install/config.rb', line 8 def install_url @install_url end |
#puppet_version ⇒ Object
Returns the value of attribute puppet_version.
8 9 10 |
# File 'lib/vagrant-puppet-install/config.rb', line 8 def puppet_version @puppet_version end |
#validate_version ⇒ Object
Returns the value of attribute validate_version.
8 9 10 |
# File 'lib/vagrant-puppet-install/config.rb', line 8 def validate_version @validate_version end |
Instance Method Details
#finalize! ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/vagrant-puppet-install/config.rb', line 17 def finalize! if @puppet_version == UNSET_VALUE @puppet_version = nil elsif @puppet_version.to_s == 'latest' # resolve `latest` to a real version @puppet_version = retrieve_latest_puppet_version end @validate_version = nil if @validate_version == UNSET_VALUE @install_url = nil if @install_url == UNSET_VALUE end |
#validate!(_machine) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/vagrant-puppet-install/config.rb', line 28 def validate!(_machine) finalize! errors = [] if falsey?(validate_version) @logger.debug("Not validating version due to validate_version being false") else if !puppet_version.nil? && !valid_puppet_version?(puppet_version) msg = <<-EOH '#{ puppet_version }' is not a valid version of Puppet. A list of valid versions can be found at: http://docs.puppetlabs.com/release_notes/ EOH errors << msg end end if errors.any? rendered_errors = Vagrant::Util::TemplateRenderer.render( 'config/validation_failed', errors: { 'vagrant-puppet-install' => errors } ) raise Vagrant::Errors::ConfigInvalid, errors: rendered_errors end end |