Class: VagrantPlugins::PuppetInstall::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-puppet-install/config.rb

Overview

Author:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



30
31
32
33
# File 'lib/vagrant-puppet-install/config.rb', line 30

def initialize
  @puppet_version = UNSET_VALUE
  @logger = Log4r::Logger.new('vagrantplugins::puppet_install::config')
end

Instance Attribute Details

#puppet_versionString

Returns The version of Puppet to install.

Returns:

  • (String)

    The version of Puppet to install.



28
29
30
# File 'lib/vagrant-puppet-install/config.rb', line 28

def puppet_version
  @puppet_version
end

Instance Method Details

#finalize!Object



35
36
37
38
39
40
41
42
# File 'lib/vagrant-puppet-install/config.rb', line 35

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
end

#validate(machine) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vagrant-puppet-install/config.rb', line 44

def validate(machine)
  errors = []

  unless 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

  { 'Puppet Install Plugin' => errors }
end