Class: BeakerAnswers::Upgrade38
- Defined in:
- lib/beaker-answers/versions/upgrade38.rb
Overview
In the case of upgrades, we lay down only necessary answers
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 Upgrade
Methods inherited from Answers
#answer_for, #answer_hiera, #answer_string, #answers, create, #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
.upgrade_version_matcher ⇒ Object
5 6 7 |
# File 'lib/beaker-answers/versions/upgrade38.rb', line 5 def self.upgrade_version_matcher /\A3\.8/ end |
Instance Method Details
#generate_answers ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/beaker-answers/versions/upgrade38.rb', line 9 def generate_answers the_answers = super dashboard = only_host_with_role(@hosts, 'dashboard') master = only_host_with_role(@hosts, 'master') database = only_host_with_role(@hosts, 'database') @hosts.each do |host| # Both the dashboard and database need shared answers about the new console services if host == dashboard || host == database the_answers[host.name][:q_rbac_database_name] = answer_for(@options, :q_rbac_database_name) the_answers[host.name][:q_rbac_database_user] = answer_for(@options, :q_rbac_database_user) the_answers[host.name][:q_rbac_database_password] = "'#{answer_for(@options, :q_rbac_database_password)}'" the_answers[host.name][:q_activity_database_name] = answer_for(@options, :q_activity_database_name) the_answers[host.name][:q_activity_database_user] = answer_for(@options, :q_activity_database_user) the_answers[host.name][:q_activity_database_password] = "'#{answer_for(@options, :q_activity_database_password)}'" the_answers[host.name][:q_classifier_database_name] = answer_for(@options, :q_classifier_database_name) the_answers[host.name][:q_classifier_database_user] = answer_for(@options, :q_classifier_database_user) the_answers[host.name][:q_classifier_database_password] = "'#{answer_for(@options, :q_classifier_database_password)}'" the_answers[host.name][:q_puppetmaster_certname] = answer_for(@options, :q_puppetmaster_certname) # The dashboard also needs additional answers about puppetdb on the remote host if host == dashboard the_answers[host.name][:q_puppet_enterpriseconsole_auth_password] = "'#{answer_for(@options, :q_puppet_enterpriseconsole_auth_password)}'" the_answers[host.name][:q_puppetdb_hostname] = answer_for(@options, :q_puppetdb_hostname) the_answers[host.name][:q_puppetdb_database_password] = "'#{answer_for(@options, :q_puppetdb_database_password)}'" the_answers[host.name][:q_puppetdb_database_name] = answer_for(@options, :q_puppetdb_database_name) the_answers[host.name][:q_puppetdb_database_user] = answer_for(@options, :q_puppetdb_database_user) the_answers[host.name][:q_puppetdb_port] = answer_for(@options, :q_puppetdb_port) end end # merge custom host answers if available the_answers[host.name] = the_answers[host.name].merge(host[:custom_answers]) if host[:custom_answers] end the_answers.map do |hostname, answers| # First check to see if there is a host option for this setting # and skip to the next object if it is already defined. if the_answers[hostname][:q_enable_future_parser] next # Check now if it was set in the global options. elsif @options[:answers] && @options[:answers][:q_enable_future_parser] the_answers[hostname][:q_enable_future_parser] = @options[:answers][:q_enable_future_parser] next # If we didn't set it on a per host or global option basis, set it to # 'y' here. We could have possibly set it in the DEFAULT_ANSWERS, but it # is unclear what kind of effect that might have on all the other answers # that rely on it defaulting to 'n'. else the_answers[hostname][:q_enable_future_parser] = 'y' end end the_answers.map do |hostname, answers| # First check to see if there is a host option for this setting # and skip to the next object if it is already defined. if the_answers[hostname][:q_exit_for_nc_migrate] next # Check now if it was set in the global options. elsif @options[:answers] && @options[:answers][:q_exit_for_nc_migrate] the_answers[hostname][:q_exit_for_nc_migrate] = @options[:answers][:q_exit_for_nc_migrate] next # If we didn't set it on a per host or global option basis, set it to # 'n' here. We could have possibly set it in the DEFAULT_ANSWERS, but it # is unclear what kind of effect that might have on all the other answers # that rely on it defaulting to 'n'. else the_answers[hostname][:q_exit_for_nc_migrate] = 'n' end end the_answers end |