Class: BeakerAnswers::PeConf

Inherits:
Object
  • Object
show all
Defined in:
lib/beaker-answers/pe_conf.rb

Overview

Used to generate a Hash of configuration appropriate for generating the initial MEEP pe.conf for a given set of hosts and a particular MEEP pe.conf schema version.

Constant Summary collapse

DEFAULT_VERSION =

The default pe.conf schema version.

'1.0'.freeze
COMPONENTS =

This lists various aliases for different PE components that might be installed on a host.

The first entry in the list is the canonical name for the component from the PuppetX::Puppetlabs::Meep::Config.pe_components() from the pe_infrastructure module.

Secondary aliases are the various working names that have been used with beaker in CI to establish that a host has that component installed on it.

[
  ["primary_master", "master"],
  ["primary_master_replica"],
  # the 'database' alias will be troublesome if/when we begin
  # breaking out a managed database (as opposed to external)
  # in future PE layouts.
  ["puppetdb", "database"],
  ["console", "classifier", "dashboard"],
  ["compile_master"],
  ["mco_hub", "hub"],
  ["mco_broker", "spoke"],
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hosts, meep_schema_version, options = {}) ⇒ PeConf

The array of Beaker hosts are inspected to provide configuration for master, database, console nodes, and other configuration data as required by the particular pe.conf version.



45
46
47
48
49
# File 'lib/beaker-answers/pe_conf.rb', line 45

def initialize(hosts, meep_schema_version, options = {})
  self.hosts = hosts
  self.meep_schema_version = meep_schema_version || DEFAULT_VERSION
  self.options = options || {}
end

Instance Attribute Details

#hostsObject

Returns the value of attribute hosts.



33
34
35
# File 'lib/beaker-answers/pe_conf.rb', line 33

def hosts
  @hosts
end

#meep_schema_versionObject

Returns the value of attribute meep_schema_version.



33
34
35
# File 'lib/beaker-answers/pe_conf.rb', line 33

def meep_schema_version
  @meep_schema_version
end

#optionsObject

Returns the value of attribute options.



33
34
35
# File 'lib/beaker-answers/pe_conf.rb', line 33

def options
  @options
end

Instance Method Details

#configuration_hashHash

Returns of pe.conf configuration data.

Raises:

  • RuntimeError if no implementation can be found for the meep_schema_version.



54
55
56
57
58
59
60
61
62
# File 'lib/beaker-answers/pe_conf.rb', line 54

def configuration_hash
  case meep_schema_version
  when '1.0'
    _generate_1_0_data
  when '2.0'
    _generate_2_0_data
  else raise(RuntimeError, "Unknown how to produce pe.conf data for meep_schema_version: '#{meep_schema_version}'")
  end
end