Class: BeakerAnswers::Version20172 Private

Inherits:
Version20171 show all
Defined in:
lib/beaker-answers/versions/version20172.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class provides answer file information for PE version 2017.2

Direct Known Subclasses

Version20173to9999

Constant Summary

Constants inherited from Answers

Answers::DEFAULT_ANSWERS, Answers::DEFAULT_FORMAT, Answers::DEFAULT_HIERA_ANSWERS

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Version20163

#generate_answers

Methods inherited from Version20162

#answer_hiera, #generate_answers, #generate_bash_answers, #hiera_db_config, #installer_configuration_string

Methods inherited from Version20153

#generate_answers

Methods inherited from Version40

#generate_answers

Methods inherited from Version38

#generate_answers

Methods inherited from Version34

#generate_answers

Methods inherited from Version32

#generate_answers

Methods inherited from Version30

#generate_answers, #host_answers

Methods inherited from Answers

#answer_for, #answer_hiera, #answer_string, #answers, create, #generate_answers, #get_defaults_or_answers, #initialize, #installer_configuration_string, #only_host_with_role, supported_upgrade_versions, supported_versions

Constructor Details

This class inherits a constructor from BeakerAnswers::Answers

Class Method Details

.pe_version_matcherObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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



9
10
11
# File 'lib/beaker-answers/versions/version20172.rb', line 9

def self.pe_version_matcher
  /\A2017\.2/
end

Instance Method Details

#generate_hiera_configObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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_configObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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.



39
40
41
42
# 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