manageiq-appliance_console 5.3.3 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a99381d9971cd71fb886c2c7b60a28e3264b02d468bd48a16c1989928f799419
4
- data.tar.gz: a15cd7e5d850029323feb202734d76cf873e84b174c25ad1328da88a74e5cb24
3
+ metadata.gz: 4d64670c30bb37f4487aefa66bc59a4cf610650416157fe04efbe9400e96ba98
4
+ data.tar.gz: 89a871ff8bdbb6b5a44df5e1a733527534f41bd45200138fa939b5bb9091592d
5
5
  SHA512:
6
- metadata.gz: a17a761d4fafe81ab5316a750a5416f99aad51d58d5283b5d7b9c236272cee2fce3811533819078a907ae764d6c42803d2e3c8957ed68992c0d438413d22d2fc
7
- data.tar.gz: '0873216da956c061c3fc0b6b1b27654bce9606444522216b6d05ed55dca28bdc2ddfab3aadde9a45d858cdf185d48d12bf8021d2e1a7e2921b47909417974fef'
6
+ metadata.gz: 381c19281a65a2617e269cac0fbe16bb0e2dc75d6f58a2439550e14f2bb4b56d47cc676491c0ce1f89f15891bed6e57199b66fa14fc3a5b9f2653a8d2c7bd068
7
+ data.tar.gz: 4a649d02282f5301b2aa6452455037cc35121d75e7888a5613508b7009578d6c398f9953ea7e210230626b4049d7db347c5bafedcf2dc66976b4207a34bf1778
@@ -374,7 +374,7 @@ Static Network Configuration
374
374
  raise MiqSignalError
375
375
  end
376
376
 
377
- when I18n.t("advanced_settings.db_config")
377
+ when I18n.t("advanced_settings.app_config")
378
378
  say("#{selection}\n\n")
379
379
 
380
380
  ensure_key_configured
@@ -383,21 +383,29 @@ Static Network Configuration
383
383
  "Create Internal Database" => "create_internal",
384
384
  "Create Region in External Database" => "create_external",
385
385
  "Join Region in External Database" => "join_external",
386
- "Reset Configured Database" => "reset_region"
386
+ "Reset Configured Database" => "reset_region",
387
+ "No changes" => "no_changes"
387
388
  }
388
- action = ask_with_menu("Database Operation", options)
389
+ database_action = ask_with_menu("Database Operation", options)
390
+
391
+ messaging_options = {
392
+ "Use an external messaging system" => "external_messaging",
393
+ "No changes" => "no_changes"
394
+ }
395
+
396
+ messaging_action = ask_with_menu("Configure Messaging", messaging_options)
389
397
 
390
398
  database_configuration =
391
- case action
399
+ case database_action
392
400
  when "create_internal"
393
401
  ManageIQ::ApplianceConsole::InternalDatabaseConfiguration.new
394
402
  when /_external/
395
- ManageIQ::ApplianceConsole::ExternalDatabaseConfiguration.new(:action => action.split("_").first.to_sym)
403
+ ManageIQ::ApplianceConsole::ExternalDatabaseConfiguration.new(:action => database_action.split("_").first.to_sym)
396
404
  else
397
405
  ManageIQ::ApplianceConsole::DatabaseConfiguration.new
398
406
  end
399
407
 
400
- case action
408
+ case database_action
401
409
  when "reset_region"
402
410
  if database_configuration.reset_region
403
411
  say("Database reset successfully")
@@ -411,6 +419,11 @@ Static Network Configuration
411
419
  # Get the region again because it may have changed
412
420
  region = ManageIQ::ApplianceConsole::DatabaseConfiguration.region
413
421
 
422
+ case messaging_action
423
+ when "external_messaging"
424
+ ManageIQ::ApplianceConsole::MessagingConfiguration.new.run_interactive
425
+ end
426
+
414
427
  press_any_key
415
428
 
416
429
  when I18n.t("advanced_settings.db_replication")
@@ -43,6 +43,7 @@ require 'manageiq/appliance_console/internal_database_configuration'
43
43
  require 'manageiq/appliance_console/key_configuration'
44
44
  require 'manageiq/appliance_console/logfile_configuration'
45
45
  require 'manageiq/appliance_console/logical_volume_management'
46
+ require 'manageiq/appliance_console/messaging_configuration'
46
47
  require 'manageiq/appliance_console/oidc_authentication'
47
48
  require 'manageiq/appliance_console/principal'
48
49
  require 'manageiq/appliance_console/saml_authentication'
@@ -101,6 +101,10 @@ module ApplianceConsole
101
101
  options[:openscap]
102
102
  end
103
103
 
104
+ def configure_messaging?
105
+ options[:messaging_hostname] && options[:messaging_password] && options[:messaging_port] && options[:messaging_username]
106
+ end
107
+
104
108
  def initialize(options = {})
105
109
  self.options = options
106
110
  end
@@ -169,6 +173,10 @@ module ApplianceConsole
169
173
  opt :oidc_unconfig, "Unconfigure Appliance OpenID-Connect Authentication", :type => :boolean, :default => false
170
174
  opt :server, "{start|stop|restart} actions on evmserverd Server", :type => :string
171
175
  opt :openscap, "Setup OpenScap", :type => :boolean, :default => false
176
+ opt :messaging_hostname, "Messaging Hostname", :type => :string
177
+ opt :messaging_username, "Messaging Username", :type => :string
178
+ opt :messaging_password, "Messaging Password", :type => :string
179
+ opt :messaging_port, "Messaging Port", :type => :integer
172
180
  end
173
181
  Optimist.die :region, "needed when setting up a local database" if region_number_required? && options[:region].nil?
174
182
  self
@@ -183,7 +191,7 @@ module ApplianceConsole
183
191
  uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
184
192
  set_server_state? || set_replication? || openscap? ||
185
193
  saml_config? || saml_unconfig? ||
186
- oidc_config? || oidc_unconfig?
194
+ oidc_config? || oidc_unconfig? || configure_messaging?
187
195
 
188
196
  if set_host?
189
197
  system_hosts = LinuxAdmin::Hosts.new
@@ -207,6 +215,7 @@ module ApplianceConsole
207
215
  oidc_unconfig if oidc_unconfig?
208
216
  set_server_state if set_server_state?
209
217
  openscap if openscap?
218
+ configure_messaging if configure_messaging?
210
219
  rescue CliError => e
211
220
  say(e.message)
212
221
  say("")
@@ -426,6 +435,16 @@ module ApplianceConsole
426
435
  def self.parse(args)
427
436
  new.parse(args).run
428
437
  end
438
+
439
+ def configure_messaging
440
+ say("configuring messaging")
441
+ ManageIQ::ApplianceConsole::MessagingConfiguration.new.save(
442
+ "hostname" => options[:messaging_hostname],
443
+ "password" => options[:messaging_password],
444
+ "port" => options[:messaging_port],
445
+ "username" => options[:messaging_username]
446
+ )
447
+ end
429
448
  end
430
449
  end
431
450
  end
@@ -0,0 +1,92 @@
1
+ require "pathname"
2
+
3
+ module ManageIQ
4
+ module ApplianceConsole
5
+ class MessagingConfiguration
6
+ include ManageIQ::ApplianceConsole::Logging
7
+ include ManageIQ::ApplianceConsole::Prompts
8
+
9
+ MESSAGING_YML = ManageIQ::ApplianceConsole::RAILS_ROOT.join("config/messaging.yml")
10
+
11
+ attr_accessor :host, :password, :port, :username
12
+
13
+ def run_interactive
14
+ ask_questions
15
+
16
+ clear_screen
17
+ say("Activating the configuration using the following settings...\n#{friendly_inspect}\n")
18
+
19
+ raise MiqSignalError unless activate
20
+
21
+ say("\nConfiguration activated successfully.\n")
22
+ rescue RuntimeError => e
23
+ puts "Configuration failed#{": " + e.message unless e.class == MiqSignalError}"
24
+ press_any_key
25
+ raise MiqSignalError
26
+ end
27
+
28
+ def ask_questions
29
+ ask_for_messaging_credentials
30
+ end
31
+
32
+ def ask_for_messaging_credentials
33
+ self.host = ask_for_ip_or_hostname("messaging hostname or IP address")
34
+ self.port = ask_for_integer("port number", (1..65_535), 9_092).to_i
35
+ self.username = just_ask("username")
36
+ count = 0
37
+ loop do
38
+ password1 = ask_for_password("messaging password on #{host}")
39
+
40
+ if password1.strip.empty?
41
+ say("\nPassword can not be empty, please try again")
42
+ next
43
+ end
44
+
45
+ password2 = ask_for_password("messaging password again")
46
+ if password1 == password2
47
+ self.password = password1
48
+ break
49
+ elsif count > 0 # only reprompt password once
50
+ raise "passwords did not match"
51
+ else
52
+ count += 1
53
+ say("\nThe passwords did not match, please try again")
54
+ end
55
+ end
56
+ end
57
+
58
+ def friendly_inspect
59
+ <<~END_OF_INSPECT
60
+ Host: #{host}
61
+ Username: #{username}
62
+ Port: #{port}
63
+ END_OF_INSPECT
64
+ end
65
+
66
+ def activate
67
+ save
68
+ true
69
+ end
70
+
71
+ private
72
+
73
+ def settings_from_input
74
+ {
75
+ "hostname" => host,
76
+ "password" => password,
77
+ "port" => port,
78
+ "username" => username
79
+ }
80
+ end
81
+
82
+ def save(settings = nil)
83
+ settings ||= settings_from_input
84
+
85
+ settings["password"] = MiqPassword.try_encrypt(settings.delete("password"))
86
+
87
+ require 'yaml'
88
+ File.write(MESSAGING_YML, YAML.dump("production" => settings))
89
+ end
90
+ end
91
+ end
92
+ end
@@ -1,5 +1,5 @@
1
1
  module ManageIQ
2
2
  module ApplianceConsole
3
- VERSION = '5.3.3'.freeze
3
+ VERSION = '5.4.0'.freeze
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ en:
8
8
  - dbbackup
9
9
  - dbdump
10
10
  - dbrestore
11
- - db_config
11
+ - app_config
12
12
  - db_replication
13
13
  - log_config
14
14
  - failover_monitor
@@ -25,7 +25,7 @@ en:
25
25
  dbbackup: Create Database Backup
26
26
  dbdump: Create Database Dump
27
27
  dbrestore: Restore Database From Backup
28
- db_config: Configure Database
28
+ app_config: Configure Application
29
29
  db_replication: Configure Database Replication
30
30
  log_config: Logfile Configuration
31
31
  failover_monitor: Configure Application Database Failover Monitor
@@ -5,7 +5,7 @@ en:
5
5
  advanced_settings:
6
6
  menu_order:
7
7
  - dbrestore
8
- - db_config
8
+ - app_config
9
9
  - db_replication
10
10
  - failover_monitor
11
11
  - key_gen
@@ -15,7 +15,7 @@ en:
15
15
  - summary
16
16
  - quit
17
17
  dbrestore: Restore Database From Backup
18
- db_config: Configure Database
18
+ app_config: Configure Application
19
19
  db_replication: Configure Database Replication
20
20
  failover_monitor: Configure Application Database Failover Monitor
21
21
  evmstop: Stop EVM Server Processes
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: manageiq-appliance_console
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.3.3
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ManageIQ Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-02 00:00:00.000000000 Z
11
+ date: 2020-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -347,6 +347,7 @@ files:
347
347
  - lib/manageiq/appliance_console/logger.rb
348
348
  - lib/manageiq/appliance_console/logging.rb
349
349
  - lib/manageiq/appliance_console/logical_volume_management.rb
350
+ - lib/manageiq/appliance_console/messaging_configuration.rb
350
351
  - lib/manageiq/appliance_console/oidc_authentication.rb
351
352
  - lib/manageiq/appliance_console/principal.rb
352
353
  - lib/manageiq/appliance_console/prompts.rb