manageiq-appliance_console 5.3.2 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3276f6f2b22a3501da156ea9e656495e9c91bb27e9f0a44c9ffaa149ce264d26
4
- data.tar.gz: 4535caa205126d59deff41e2df1348e083b5a151b20c710b8664c8f3358ee7db
3
+ metadata.gz: 34445fe4cc1b697688c30f689ed12499635959a5ad428763f2cfaac48a9f64c9
4
+ data.tar.gz: ed7530438fc6d4cf6d143e99bee966a890af509bdcb065831db8897b995a7fa8
5
5
  SHA512:
6
- metadata.gz: fa49faeff2176cc790659924a5acd4af02c682320f80afb8562d60bec1cb6b6541bfdeab5265008d0b921f35993ba285d825844c69b4d3644e7d7b879401fff0
7
- data.tar.gz: 658510d617fbf89d36596312820623f1bf56692c80fe891b4b9353cac557edd195255e36234b15b1cd773ad1f3cc55cbff7f8bde8f8d964b016328d7efca7d21
6
+ metadata.gz: a35d79649faa4a600b16959312a35468737a49f106524a510ee6d917154eb736547980a5597edc853b39325730ec3eece30efd4ed7375717525f5ad56ae3191e
7
+ data.tar.gz: 537c818711a763daa128491cf61895fac0646a568d7b9f39d7701707ecfcef33272d1f0cb7347290f1f61e10eb4cb7729ad2cadd18556ab5c9dd8888c7104842
data/.codeclimate.yml CHANGED
@@ -1,13 +1,18 @@
1
- ---
2
- exclude_paths:
3
- - ".git/"
4
- - "**.xml"
5
- - "**.yaml"
6
- - "**.yml"
7
- - locale/
8
- - spec/
9
- - tools/
10
- engines:
1
+ prepare:
2
+ fetch:
3
+ - url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_base.yml
4
+ path: ".rubocop_base.yml"
5
+ - url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/.rubocop_cc_base.yml
6
+ path: ".rubocop_cc_base.yml"
7
+ - url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/base.yml
8
+ path: styles/base.yml
9
+ - url: https://raw.githubusercontent.com/ManageIQ/manageiq-style/master/styles/cc_base.yml
10
+ path: styles/cc_base.yml
11
+ plugins:
12
+ rubocop:
13
+ enabled: true
14
+ config: ".rubocop_cc.yml"
15
+ channel: rubocop-0-82
11
16
  brakeman:
12
17
  enabled: false
13
18
  bundler-audit:
@@ -27,18 +32,12 @@ engines:
27
32
  enabled: false
28
33
  markdownlint:
29
34
  enabled: false
30
- rubocop:
31
- enabled: true
32
- config: ".rubocop_cc.yml"
33
- channel: rubocop-0-69
34
- prepare:
35
- fetch:
36
- - url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
37
- path: ".rubocop_base.yml"
38
- - url: https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_cc_base.yml
39
- path: ".rubocop_cc_base.yml"
40
- ratings:
41
- paths:
42
- - Gemfile.lock
43
- - "**.rake"
44
- - "**.rb"
35
+ exclude_patterns:
36
+ - ".git/"
37
+ - "**.xml"
38
+ - "**.yaml"
39
+ - "**.yml"
40
+ - locale/
41
+ - spec/
42
+ - tools/
43
+ version: '2'
data/.rspec_ci CHANGED
@@ -1,4 +1,6 @@
1
+ --require ci_helper
1
2
  --require spec_helper
2
3
  --color
3
4
  --order random
4
5
  --profile
6
+ --format documentation
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
+ inherit_gem:
2
+ manageiq-style: ".rubocop_base.yml"
1
3
  inherit_from:
2
- - https://raw.githubusercontent.com/ManageIQ/guides/master/.rubocop_base.yml
3
- # put all local rubocop config into .rubocop_local.yml as it will be loaded by .rubocop_cc.yml as well
4
- - .rubocop_local.yml
4
+ - ".rubocop_local.yml"
data/.rubocop_cc.yml CHANGED
@@ -1,5 +1,4 @@
1
1
  inherit_from:
2
- # this is downloaded by .codeclimate.yml
3
- - .rubocop_base.yml
4
- - .rubocop_cc_base.yml
5
- - .rubocop_local.yml
2
+ - ".rubocop_base.yml"
3
+ - ".rubocop_cc_base.yml"
4
+ - ".rubocop_local.yml"
data/.rubocop_local.yml CHANGED
@@ -1,2 +1,2 @@
1
- # GlobalVars:
1
+ # Style/GlobalVars:
2
2
  # AllowedVariables:
data/.travis.yml CHANGED
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  language: ruby
3
3
  rvm:
4
- - 2.5.7
5
- - 2.6.5
6
- sudo: false
4
+ - 2.6.6
5
+ - 2.7.2
7
6
  cache: bundler
7
+ addons:
8
+ postgresql: '10'
8
9
  env:
9
10
  global:
10
11
  - RUBY_GC_HEAP_GROWTH_MAX_SLOTS=300000
data/Gemfile CHANGED
@@ -1,7 +1,5 @@
1
1
  source 'http://rubygems.manageiq.org'
2
2
  source 'https://rubygems.org'
3
3
 
4
- # Specify your gem's dependencies in manageiq-smartstate.gemspec
4
+ # Specify your gem's dependencies in manageiq-appliance_console.gemspec
5
5
  gemspec
6
-
7
- gem "manageiq-gems-pending", :git => "https://github.com/ManageIQ/manageiq-gems-pending", :branch => "master"
data/README.md CHANGED
@@ -1,10 +1,9 @@
1
1
  # ManageIQ::ApplianceConsole
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/manageiq-appliance_console.svg)](http://badge.fury.io/rb/manageiq-appliance_console)
4
- [![Build Status](https://travis-ci.org/ManageIQ/manageiq-appliance_console.svg?branch=master)](https://travis-ci.org/ManageIQ/manageiq-appliance_console)
4
+ [![Build Status](https://travis-ci.com/ManageIQ/manageiq-appliance_console.svg?branch=master)](https://travis-ci.com/ManageIQ/manageiq-appliance_console)
5
5
  [![Code Climate](https://codeclimate.com/github/ManageIQ/manageiq-appliance_console.svg)](https://codeclimate.com/github/ManageIQ/manageiq-appliance_console)
6
6
  [![Test Coverage](https://codeclimate.com/github/ManageIQ/manageiq-appliance_console/badges/coverage.svg)](https://codeclimate.com/github/ManageIQ/manageiq-appliance_console/coverage)
7
- [![Dependency Status](https://gemnasium.com/ManageIQ/manageiq-appliance_console.svg)](https://gemnasium.com/ManageIQ/manageiq-appliance_console)
8
7
  [![Security](https://hakiri.io/github/ManageIQ/manageiq-appliance_console/master.svg)](https://hakiri.io/github/ManageIQ/manageiq-appliance_console/master)
9
8
 
10
9
  [![Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ManageIQ/manageiq-appliance_console?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
data/Rakefile CHANGED
@@ -1,6 +1,25 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
3
 
4
+ desc "Run RSpec code examples (skip postgres required ones)"
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- task :default => :spec
7
+ # In CI, as part of the .rspec_ci, load a helper that sets the configuration
8
+ # setting to allow the postgres specs to run.
9
+ desc "Run RSpec code examples (assumes ci dependencies)"
10
+ RSpec::Core::RakeTask.new("spec:ci") do |t|
11
+ t.rspec_opts = "--options #{File.expand_path(".rspec_ci", __dir__)}"
12
+ end
13
+
14
+ desc "Run RSpec code examples (with local postgres dependencies)"
15
+ RSpec::Core::RakeTask.new("spec:dev") do |t|
16
+ # Load the PostgresRunner helper to facilitate a clean postgres environment
17
+ # for testing locally (not necessary for CI), and enables the postgres test
18
+ # via the helper.
19
+ pg_runner = File.join("spec", "postgres_runner_helper.rb")
20
+ t.rspec_opts = "-r #{File.expand_path(pg_runner, __dir__)}"
21
+ end
22
+
23
+ task :default do
24
+ Rake::Task["spec#{':ci' if ENV['CI']}"].invoke
25
+ end
@@ -13,7 +13,7 @@ require 'highline/system_extensions'
13
13
  require 'rubygems'
14
14
  require 'bcrypt'
15
15
  require 'linux_admin'
16
- require 'util/postgres_admin'
16
+ require 'manageiq/appliance_console/postgres_admin'
17
17
  require 'awesome_spawn'
18
18
  include HighLine::SystemExtensions
19
19
 
@@ -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,30 @@ 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
+ "Make No Database 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
+ "Configure this appliance as a messaging server" => "message_server",
393
+ "Connect to an external messaging system" => "message_client",
394
+ "Make No messaging changes" => "no_changes"
395
+ }
396
+
397
+ messaging_action = ask_with_menu("Configure Messaging", messaging_options)
389
398
 
390
399
  database_configuration =
391
- case action
400
+ case database_action
392
401
  when "create_internal"
393
402
  ManageIQ::ApplianceConsole::InternalDatabaseConfiguration.new
394
403
  when /_external/
395
- ManageIQ::ApplianceConsole::ExternalDatabaseConfiguration.new(:action => action.split("_").first.to_sym)
404
+ ManageIQ::ApplianceConsole::ExternalDatabaseConfiguration.new(:action => database_action.split("_").first.to_sym)
396
405
  else
397
406
  ManageIQ::ApplianceConsole::DatabaseConfiguration.new
398
407
  end
399
408
 
400
- case action
409
+ case database_action
401
410
  when "reset_region"
402
411
  if database_configuration.reset_region
403
412
  say("Database reset successfully")
@@ -411,6 +420,34 @@ Static Network Configuration
411
420
  # Get the region again because it may have changed
412
421
  region = ManageIQ::ApplianceConsole::DatabaseConfiguration.region
413
422
 
423
+ case messaging_action
424
+ when "message_server"
425
+ say("#{selection}\n\n")
426
+
427
+ message_server = MessageServerConfiguration.new
428
+ if message_server.ask_questions && message_server.configure
429
+ say("\nMessage Server configured successfully.\n")
430
+ press_any_key
431
+ else
432
+ say("\nMessage Server configuration failed!\n")
433
+ press_any_key
434
+ raise MiqSignalError
435
+ end
436
+
437
+ when "message_client"
438
+ say("#{selection}\n\n")
439
+
440
+ message_client = MessageClientConfiguration.new
441
+ if message_client.ask_questions && message_client.configure
442
+ say("\nMessage Client configured successfully.\n")
443
+ press_any_key
444
+ else
445
+ say("\nMessage Client configuration failed!\n")
446
+ press_any_key
447
+ raise MiqSignalError
448
+ end
449
+ end
450
+
414
451
  press_any_key
415
452
 
416
453
  when I18n.t("advanced_settings.db_replication")
@@ -11,10 +11,6 @@ module ManageIQ
11
11
  def self.logger
12
12
  @logger ||= ManageIQ::ApplianceConsole::Logger.instance
13
13
  end
14
-
15
- def self.logger=(logger)
16
- @logger = logger
17
- end
18
14
  end
19
15
  end
20
16
 
@@ -24,7 +20,6 @@ require 'manageiq/appliance_console/logger'
24
20
  require 'manageiq/appliance_console/logging'
25
21
  require 'manageiq/appliance_console/prompts'
26
22
 
27
- require 'manageiq-gems-pending'
28
23
  require 'highline'
29
24
 
30
25
  require 'manageiq/appliance_console/auth_utilities'
@@ -43,6 +38,8 @@ require 'manageiq/appliance_console/internal_database_configuration'
43
38
  require 'manageiq/appliance_console/key_configuration'
44
39
  require 'manageiq/appliance_console/logfile_configuration'
45
40
  require 'manageiq/appliance_console/logical_volume_management'
41
+ require 'manageiq/appliance_console/message_configuration_client'
42
+ require 'manageiq/appliance_console/message_configuration_server'
46
43
  require 'manageiq/appliance_console/oidc_authentication'
47
44
  require 'manageiq/appliance_console/principal'
48
45
  require 'manageiq/appliance_console/saml_authentication'
@@ -1,6 +1,6 @@
1
1
  require 'fileutils'
2
2
  require 'tempfile'
3
- require 'util/postgres_admin'
3
+ require 'manageiq/appliance_console/postgres_admin'
4
4
 
5
5
  module ManageIQ
6
6
  module ApplianceConsole
@@ -77,6 +77,22 @@ module ApplianceConsole
77
77
  options[:saml_unconfig]
78
78
  end
79
79
 
80
+ def message_server_config?
81
+ options[:message_server_config]
82
+ end
83
+
84
+ def message_server_unconfig?
85
+ options[:message_server_unconfig]
86
+ end
87
+
88
+ def message_client_config?
89
+ options[:message_client_config]
90
+ end
91
+
92
+ def message_client_unconfig?
93
+ options[:message_client_unconfig]
94
+ end
95
+
80
96
  def oidc_config?
81
97
  options[:oidc_config]
82
98
  end
@@ -165,15 +181,42 @@ module ApplianceConsole
165
181
  opt :oidc_client_host, "Optional Appliance host used for OpenID-Connect Authentication", :type => :string
166
182
  opt :oidc_client_id, "The OpenID-Connect Provider Client ID", :type => :string
167
183
  opt :oidc_client_secret, "The OpenID-Connect Provider Client Secret", :type => :string
184
+ opt :oidc_insecure, "OpenID-Connect Insecure No SSL Verify (development)", :type => :boolean, :default => false
185
+ opt :oidc_introspection_endpoint, "The OpenID-Connect Provider Introspect Endpoint", :type => :string
168
186
  opt :oidc_enable_sso, "Optionally enable SSO with OpenID-Connect Authentication", :type => :boolean, :default => false
169
187
  opt :oidc_unconfig, "Unconfigure Appliance OpenID-Connect Authentication", :type => :boolean, :default => false
170
188
  opt :server, "{start|stop|restart} actions on evmserverd Server", :type => :string
171
189
  opt :openscap, "Setup OpenScap", :type => :boolean, :default => false
190
+ opt :message_server_config, "Subcommand to Configure Appliance as a Kafka Message Server", :type => :boolean, :default => false
191
+ opt :message_server_unconfig, "Subcommand to Unconfigure Appliance as a Kafka Message Server", :type => :boolean, :default => false
192
+ opt :message_client_config, "Subcommand to Configure Appliance as a Kafka Message Client", :type => :boolean, :default => false
193
+ opt :message_client_unconfig, "Subcommand to Unconfigure Appliance as a Kafka Message Client", :type => :boolean, :default => false
194
+ opt :message_keystore_username, "Message Server Keystore Username", :type => :string
195
+ opt :message_keystore_password, "Message Server Keystore Password", :type => :string
196
+ opt :message_server_username, "Message Server Username", :type => :string
197
+ opt :message_server_password, "Message Server password", :type => :string
198
+ opt :message_server_port, "Message Server Port", :type => :integer
199
+ opt :message_server_use_ipaddr, "Message Server Use Address", :type => :boolean, :default => false
200
+ opt :message_server_host, "Message Server Hostname or IP Address", :type => :string
201
+ opt :message_truststore_path_src, "Message Server Truststore Path", :type => :string
202
+ opt :message_ca_cert_path_src, "Message Server CA Cert Path", :type => :string
203
+ opt :message_persistent_disk, "Message Persistent Disk Path", :type => :string
172
204
  end
173
205
  Optimist.die :region, "needed when setting up a local database" if region_number_required? && options[:region].nil?
206
+ Optimist.die "Supply only one of --message-server-host or --message-server-use-ipaddr=true" if both_host_and_use_ip_addr_specified?
207
+ Optimist.die "Supply only one of --message-server-config, --message-server-unconfig, --message-client-config or --message-client-unconfig" if multiple_message_subcommands?
174
208
  self
175
209
  end
176
210
 
211
+ def both_host_and_use_ip_addr_specified?
212
+ !options[:message_server_host].nil? && options[:message_server_use_ipaddr] == true
213
+ end
214
+
215
+ def multiple_message_subcommands?
216
+ a = [options[:message_server_config], options[:message_server_unconfig], options[:message_client_config], options[:message_client_unconfig]]
217
+ a.each_with_object(Hash.new(0)) { |o, h| h[o] += 1 }[true] > 1
218
+ end
219
+
177
220
  def region_number_required?
178
221
  !options[:standalone] && local_database?
179
222
  end
@@ -183,7 +226,9 @@ module ApplianceConsole
183
226
  uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
184
227
  set_server_state? || set_replication? || openscap? ||
185
228
  saml_config? || saml_unconfig? ||
186
- oidc_config? || oidc_unconfig?
229
+ oidc_config? || oidc_unconfig? ||
230
+ message_server_config? || message_server_unconfig? ||
231
+ message_client_config? || message_client_unconfig?
187
232
 
188
233
  if set_host?
189
234
  system_hosts = LinuxAdmin::Hosts.new
@@ -207,6 +252,10 @@ module ApplianceConsole
207
252
  oidc_unconfig if oidc_unconfig?
208
253
  set_server_state if set_server_state?
209
254
  openscap if openscap?
255
+ message_server_config if message_server_config?
256
+ message_server_unconfig if message_server_unconfig?
257
+ message_client_config if message_client_config?
258
+ message_client_unconfig if message_client_unconfig?
210
259
  rescue CliError => e
211
260
  say(e.message)
212
261
  say("")
@@ -408,6 +457,22 @@ module ApplianceConsole
408
457
  OIDCAuthentication.new(options).unconfigure
409
458
  end
410
459
 
460
+ def message_server_config
461
+ MessageServerConfiguration.new(options).configure
462
+ end
463
+
464
+ def message_server_unconfig
465
+ MessageServerConfiguration.new(options).unconfigure
466
+ end
467
+
468
+ def message_client_config
469
+ MessageClientConfiguration.new(options).configure
470
+ end
471
+
472
+ def message_client_unconfig
473
+ MessageClientConfiguration.new(options).unconfigure
474
+ end
475
+
411
476
  def set_server_state
412
477
  service = LinuxAdmin::Service.new("evmserverd")
413
478
  service_running = service.running?
@@ -8,7 +8,8 @@ require 'fileutils'
8
8
  module ManageIQ
9
9
  module ApplianceConsole
10
10
  class DatabaseConfiguration
11
- attr_accessor :adapter, :host, :username, :database, :password, :port, :region
11
+ attr_accessor :adapter, :host, :username, :database, :port, :region
12
+ attr_reader :password
12
13
 
13
14
  class ModelWithNoBackingTable < ActiveRecord::Base
14
15
  end
@@ -1,6 +1,6 @@
1
1
  require 'pg'
2
2
  require 'English'
3
- require 'util/postgres_admin'
3
+ require 'manageiq/appliance_console/postgres_admin'
4
4
 
5
5
  module ManageIQ
6
6
  module ApplianceConsole
@@ -1,4 +1,4 @@
1
- require 'util/postgres_admin'
1
+ require 'manageiq/appliance_console/postgres_admin'
2
2
  require 'fileutils'
3
3
  require 'linux_admin'
4
4
 
@@ -1,5 +1,5 @@
1
1
  require "pathname"
2
- require "util/postgres_admin"
2
+ require "manageiq/appliance_console/postgres_admin"
3
3
  require "pg"
4
4
  require "linux_admin"
5
5
 
@@ -1,7 +1,7 @@
1
+ require "manageiq/appliance_console/utilities"
1
2
  require 'linux_admin'
2
3
  require 'pathname'
3
4
  require 'fileutils'
4
- require 'util/miq-system.rb'
5
5
 
6
6
  module ManageIQ
7
7
  module ApplianceConsole
@@ -18,7 +18,7 @@ module ApplianceConsole
18
18
  self.disk = config[:disk]
19
19
  self.new_logrotate_count = nil
20
20
 
21
- self.size = MiqSystem.disk_usage(LOGFILE_DIRECTORY)[0][:total_bytes]
21
+ self.size = Utilities.disk_usage(LOGFILE_DIRECTORY)[0][:total_bytes]
22
22
  self.current_logrotate_count = /rotate\s+(\d+)/.match(File.read(MIQ_LOGS_CONF))[1]
23
23
  self.evm_was_running = LinuxAdmin::Service.new("evmserverd").running?
24
24
  end