Module: Beaker::Answers
- Defined in:
- lib/beaker/answers.rb,
lib/beaker/answers/version20.rb,
lib/beaker/answers/version28.rb,
lib/beaker/answers/version30.rb,
lib/beaker/answers/version32.rb,
lib/beaker/answers/version34.rb
Overview
This module provides static methods for accessing PE answer file information.
Defined Under Namespace
Modules: Version20, Version28, Version30, Version32, Version34
Class Method Summary collapse
-
.answer_string(host, answers) ⇒ String
This converts a data hash provided by answers, and returns a Puppet Enterprise compatible answer file ready for use.
-
.answers(version, hosts, master_certname, options) ⇒ Hash
When given a Puppet Enterprise version, a list of hosts and other qualifying data this method will return a hash (keyed from the hosts) of default Puppet Enterprise answer file data hashes.
Class Method Details
.answer_string(host, answers) ⇒ String
This converts a data hash provided by answers, and returns a Puppet Enterprise compatible answer file ready for use.
end
53 54 55 |
# File 'lib/beaker/answers.rb', line 53 def self.answer_string(host, answers) answers[host.name].map { |k,v| "#{k}=#{v}" }.join("\n") end |
.answers(version, hosts, master_certname, options) ⇒ Hash
When given a Puppet Enterprise version, a list of hosts and other qualifying data this method will return a hash (keyed from the hosts) of default Puppet Enterprise answer file data hashes.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/beaker/answers.rb', line 21 def self.answers(version, hosts, master_certname, ) case version when /\A3\.4/ Version34.answers(hosts, master_certname, ) when /\A3\.[2-3]/ Version32.answers(hosts, master_certname, ) when /\A3\.1/ Version30.answers(hosts, master_certname, ) when /\A3\.0/ Version30.answers(hosts, master_certname, ) when /\A2\.8/ Version28.answers(hosts, master_certname, ) when /\A2\.0/ Version20.answers(hosts, master_certname, ) else raise NotImplementedError, "Don't know how to generate answers for #{version}" end end |