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
# File 'lib/vagrant-puppet-install/config.rb', line 30

def initialize
  @puppet_version = UNSET_VALUE
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



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

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



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

def validate(machine)
  errors = []

  unless valid_puppet_version?(puppet_version)
    msg = "'#{puppet_version}' is not a valid version of Puppet."
    msg << "\n\n A list of valid versions can be found at: http://docs.puppetlabs.com/release_notes/"
    errors << msg
  end

  { "Puppet Install Plugin" => errors }
end