Class: ManageIQ::ApplianceConsole::MessageClientConfiguration
- Inherits:
-
MessageConfiguration
- Object
- MessageConfiguration
- ManageIQ::ApplianceConsole::MessageClientConfiguration
- Defined in:
- lib/manageiq/appliance_console/message_configuration_client.rb
Constant Summary
Constants inherited from MessageConfiguration
ManageIQ::ApplianceConsole::MessageConfiguration::BASE_DIR, ManageIQ::ApplianceConsole::MessageConfiguration::CONFIG_DIR, ManageIQ::ApplianceConsole::MessageConfiguration::LOGS_DIR, ManageIQ::ApplianceConsole::MessageConfiguration::MIQ_CONFIG_DIR, ManageIQ::ApplianceConsole::MessageConfiguration::SAMPLE_CONFIG_DIR
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 collapse
-
#installed_files ⇒ Object
readonly
Returns the value of attribute installed_files.
-
#message_ca_cert_path_src ⇒ Object
readonly
Returns the value of attribute message_ca_cert_path_src.
-
#message_server_password ⇒ Object
readonly
Returns the value of attribute message_server_password.
-
#message_server_username ⇒ Object
readonly
Returns the value of attribute message_server_username.
-
#message_truststore_path_src ⇒ Object
readonly
Returns the value of attribute message_truststore_path_src.
Attributes inherited from MessageConfiguration
#ca_cert_path, #client_properties_path, #config_dir_path, #keystore_dir_path, #keystore_path, #message_keystore_password, #message_keystore_username, #message_server_host, #message_server_port, #messaging_yaml_path, #messaging_yaml_sample_path, #miq_config_dir_path, #sample_config_dir_path, #truststore_path
Class Method Summary collapse
Instance Method Summary collapse
- #ask_for_parameters ⇒ Object
- #configure ⇒ Object
- #fetch_ca_cert_from_server ⇒ Object
- #fetch_truststore_from_server ⇒ Object
-
#initialize(options = {}) ⇒ MessageClientConfiguration
constructor
A new instance of MessageClientConfiguration.
- #show_parameters ⇒ Object
Methods inherited from MessageConfiguration
#already_configured?, #ask_questions, available?, #configure_messaging_yaml, #create_client_properties, #file_contains?, #file_found?, #files_found?, #host_reachable?, #host_resolvable?, #remove_installed_files, #secure?, #secure_client_properties_content, #unconfigure, #unsecure_client_properties_content, #valid_environment?
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
Methods included from ManageiqUserMixin
Constructor Details
#initialize(options = {}) ⇒ MessageClientConfiguration
Returns a new instance of MessageClientConfiguration.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 13 def initialize( = {}) super() @message_server_host = [:message_server_host] @message_server_username = [:message_server_usernamed] || "root" @message_server_password = [:message_server_password] @message_truststore_path_src = [:message_truststore_path_src] || truststore_path @message_ca_cert_path_src = [:message_ca_cert_path_src] || ca_cert_path @installed_files = [client_properties_path, messaging_yaml_path, truststore_path, ca_cert_path] end |
Instance Attribute Details
#installed_files ⇒ Object (readonly)
Returns the value of attribute installed_files.
10 11 12 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 10 def installed_files @installed_files end |
#message_ca_cert_path_src ⇒ Object (readonly)
Returns the value of attribute message_ca_cert_path_src.
10 11 12 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 10 def @message_ca_cert_path_src end |
#message_server_password ⇒ Object (readonly)
Returns the value of attribute message_server_password.
10 11 12 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 10 def @message_server_password end |
#message_server_username ⇒ Object (readonly)
Returns the value of attribute message_server_username.
10 11 12 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 10 def @message_server_username end |
#message_truststore_path_src ⇒ Object (readonly)
Returns the value of attribute message_truststore_path_src.
10 11 12 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 10 def @message_truststore_path_src end |
Class Method Details
.configured? ⇒ Boolean
79 80 81 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 79 def self.configured? MessageClientConfiguration.new.installed_files.all? { |f| File.exist?(f) } end |
Instance Method Details
#ask_for_parameters ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 46 def ask_for_parameters say("\nMessage Client Parameters:\n\n") @message_server_host = ask_for_messaging_hostname("Message Server Hostname") @message_server_port = ask_for_integer("Message Server Port number", (1..65_535), 9_093).to_i @message_server_username = ask_for_string("Message Server Username", ) @message_server_password = ask_for_password("Message Server Password") @message_truststore_path_src = ask_for_string("Message Server Truststore Path", truststore_path) @message_ca_cert_path_src = ask_for_string("Message Server CA Cert Path", ca_cert_path) @message_keystore_username = ask_for_string("Message Keystore Username", ) if secure? @message_keystore_password = ask_for_messaging_password("Message Keystore Password") if secure? end |
#configure ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 26 def configure begin MessageServerConfiguration.new.unconfigure if MessageServerConfiguration.configured? configure_messaging_yaml # Set up the local message client in case EVM is actually running on this, Message Server create_client_properties # Create the client.properties configuration fle fetch_truststore_from_server # Fetch the Java Keystore from the Kafka Server fetch_ca_cert_from_server # Fetch the CA Certificate from the Kafka Server rescue AwesomeSpawn::CommandResultError => e say(e.result.output) say(e.result.error) say("") say("Failed to Configure the Message Client- #{e}") return false rescue => e say("Failed to Configure the Message Client- #{e}") return false end true end |
#fetch_ca_cert_from_server ⇒ Object
73 74 75 76 77 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 73 def fetch_ca_cert_from_server say(__method__.to_s.tr("_", " ").titleize) fetch_from_server(, ca_cert_path) end |
#fetch_truststore_from_server ⇒ Object
67 68 69 70 71 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 67 def fetch_truststore_from_server say(__method__.to_s.tr("_", " ").titleize) fetch_from_server(, truststore_path) end |
#show_parameters ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/manageiq/appliance_console/message_configuration_client.rb', line 59 def show_parameters say("\nMessage Client Configuration:\n") say("Message Client Details:\n") say(" Message Server Hostname: #{}\n") say(" Message Server Username: #{}\n") say(" Message Keystore Username: #{}\n") end |