Class: ManageIQ::ApplianceConsole::DatabaseReplicationPrimary
- Inherits:
-
DatabaseReplication
- Object
- DatabaseReplication
- ManageIQ::ApplianceConsole::DatabaseReplicationPrimary
- Includes:
- Logging
- Defined in:
- lib/manageiq/appliance_console/database_replication_primary.rb
Constant Summary collapse
- REGISTER_CMD =
'repmgr primary register'.freeze
Constants inherited from DatabaseReplication
ManageIQ::ApplianceConsole::DatabaseReplication::NETWORK_INTERFACE, ManageIQ::ApplianceConsole::DatabaseReplication::PGPASS_FILE, ManageIQ::ApplianceConsole::DatabaseReplication::REPGMR_FILE_LOCATIONS
Constants included from Prompts
Prompts::CLEAR_CODE, Prompts::DOMAIN_REGEXP, Prompts::HOSTNAME_REGEXP, Prompts::INT_REGEXP, Prompts::IPV4_REGEXP, Prompts::IPV6_REGEXP, Prompts::IP_REGEXP, Prompts::MESSAGING_HOSTNAME_REGEXP, Prompts::MESSAGING_PASSWORD_REGEXP, Prompts::NONE_REGEXP
Instance Attribute Summary
Attributes inherited from DatabaseReplication
#database_name, #database_password, #database_user, #node_number, #primary_host
Instance Method Summary collapse
- #activate ⇒ Object
- #ask_questions ⇒ Object
- #confirm ⇒ Object
-
#initialize ⇒ DatabaseReplicationPrimary
constructor
A new instance of DatabaseReplicationPrimary.
Methods included from Logging
#error_and_logging_from_command_result_error, #error_and_logging_from_standard_error, #interactive, #interactive=, interactive?, #interactive?, #log_and_feedback, #log_and_feedback_exception, #log_and_feedback_info, #log_error, #log_prefix, #logger, #logger=, #say_error, #say_info
Methods inherited from DatabaseReplication
#ask_for_database_credentials, #ask_for_unique_cluster_node_number, #config_file_contents, #confirm_reconfiguration, #create_config_file, repmgr_config, repmgr_configured?, repmgr_file_locations, repmgr_log, repmgr_service_name, #write_pgpass_file
Methods included from Prompts
#are_you_sure?, #ask_for_disk, #ask_for_domain, #ask_for_hostname, #ask_for_hour_number, #ask_for_integer, #ask_for_ip, #ask_for_ip_or_hostname, #ask_for_ip_or_hostname_or_none, #ask_for_many, #ask_for_messaging_hostname, #ask_for_messaging_password, #ask_for_month_day_number, #ask_for_new_password, #ask_for_password, #ask_for_schedule_frequency, #ask_for_string, #ask_for_uri, #ask_for_week_day_number, #ask_with_menu, #ask_yn?, #clear_screen, #default_to_index, #just_ask, #press_any_key
Constructor Details
#initialize ⇒ DatabaseReplicationPrimary
Returns a new instance of DatabaseReplicationPrimary.
8 9 10 11 12 13 14 |
# File 'lib/manageiq/appliance_console/database_replication_primary.rb', line 8 def initialize self.node_number = nil self.database_name = "vmdb_production" self.database_user = "root" self.database_password = nil self.primary_host = LinuxAdmin::NetworkInterface.new(NETWORK_INTERFACE).address end |
Instance Method Details
#activate ⇒ Object
30 31 32 33 34 35 |
# File 'lib/manageiq/appliance_console/database_replication_primary.rb', line 30 def activate say("Configuring Primary Replication Server...") create_config_file(primary_host) && run_repmgr_command(REGISTER_CMD) && write_pgpass_file end |
#ask_questions ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/manageiq/appliance_console/database_replication_primary.rb', line 16 def ask_questions clear_screen say("Establish Primary Replication Server\n") ask_for_unique_cluster_node_number ask_for_database_credentials return false if repmgr_configured? && !confirm_reconfiguration confirm end |
#confirm ⇒ Object
25 26 27 28 |
# File 'lib/manageiq/appliance_console/database_replication_primary.rb', line 25 def confirm super agree("Apply this Replication Server Configuration? (Y/N): ") end |