class BeakerAnswers::Version20172

This class provides answer file information for PE version 2017.2

@api private

Public Class Methods

pe_version_matcher() click to toggle source

The version of PE that this set of answers is appropriate for

# File lib/beaker-answers/versions/version20172.rb, line 9
def self.pe_version_matcher
  /\A2017\.2/
end

Public Instance Methods

generate_hiera_config() click to toggle source
# File lib/beaker-answers/versions/version20172.rb, line 13
def generate_hiera_config
  hiera_hash = super

  if hiera_hash.include?('meep_schema_version') && @options[:answers]
    # The meep 2.0 schema format includes structured data, which you could
    # conceivably overwrite in your :answers and not want flattened.
    # We're removing the flattened keys added in the Version20162 and
    # reading them here rather than breaking compatibilty with existing
    # Version20162 behavior. We're sorry.
    hiera_hash.reject! do |k,v|
      flatten_keys_to_joined_string(@options[:answers]).include?(k)
    end
    stringified_answers = @options[:answers].inject({}) do |hash,entry|
      key = entry[0]
      value = entry[1]
      hash[key.to_s] = value
      hash
    end
    hiera_hash.merge!(stringified_answers)
  end
  hiera_hash
end
hiera_host_config() click to toggle source

This is used to generate the profile host parameters, but now passes the options to determine which form of pe.conf is to be generated.

# File lib/beaker-answers/versions/version20172.rb, line 39
def hiera_host_config
  pe_conf = BeakerAnswers::PeConf.new(@hosts, @options[:meep_schema_version])
  pe_conf.configuration_hash
end