manageiq-appliance_console 5.5.0 → 7.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +24 -25
- data/.rspec_ci +2 -0
- data/.rubocop.yml +3 -3
- data/.rubocop_cc.yml +3 -4
- data/.rubocop_local.yml +1 -1
- data/.travis.yml +4 -3
- data/Gemfile +1 -3
- data/README.md +1 -2
- data/Rakefile +20 -1
- data/bin/appliance_console +30 -6
- data/lib/manageiq/appliance_console/certificate_authority.rb +1 -1
- data/lib/manageiq/appliance_console/cli.rb +166 -70
- data/lib/manageiq/appliance_console/database_admin.rb +35 -206
- data/lib/manageiq/appliance_console/database_configuration.rb +10 -2
- data/lib/manageiq/appliance_console/database_replication.rb +1 -1
- data/lib/manageiq/appliance_console/database_replication_standby.rb +1 -1
- data/lib/manageiq/appliance_console/external_auth_options.rb +3 -13
- data/lib/manageiq/appliance_console/internal_database_configuration.rb +4 -12
- data/lib/manageiq/appliance_console/key_configuration.rb +8 -1
- data/lib/manageiq/appliance_console/logfile_configuration.rb +2 -2
- data/lib/manageiq/appliance_console/manageiq_user_mixin.rb +15 -0
- data/lib/manageiq/appliance_console/message_configuration.rb +205 -0
- data/lib/manageiq/appliance_console/message_configuration_client.rb +98 -0
- data/lib/manageiq/appliance_console/message_configuration_server.rb +321 -0
- data/lib/manageiq/appliance_console/oidc_authentication.rb +27 -1
- data/lib/manageiq/appliance_console/postgres_admin.rb +412 -0
- data/lib/manageiq/appliance_console/utilities.rb +61 -2
- data/lib/manageiq/appliance_console/version.rb +1 -1
- data/lib/manageiq-appliance_console.rb +2 -6
- data/locales/appliance/en.yml +0 -16
- data/manageiq-appliance_console.gemspec +4 -3
- metadata +54 -24
- data/lib/manageiq/appliance_console/messaging_configuration.rb +0 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 374d440d8bb316983c6a7d104c7c24cafde547c0155d56ed575b13acabd8be7f
|
4
|
+
data.tar.gz: 76d98cfd05523759a98e5c16004590f3db844848e2dad407751cb43739e97762
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18d0b62a2cbf0ee739c30b20e1a68cfb0009465c54565b8be4adba52ee97c924e4ce50d614bb4204dbd24201da4ae9a65a4f0247c60387a935f0b65cb815b27a
|
7
|
+
data.tar.gz: ccd0ea2e1861078f1999ab76d4d254ec8b9062c460c09632209ba499b27966f929607256e9f9a389632d37433a94866de43753f36be6dfbd2685b82aeba77fc9
|
data/.codeclimate.yml
CHANGED
@@ -1,13 +1,18 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
-
|
4
|
-
|
5
|
-
-
|
6
|
-
|
7
|
-
-
|
8
|
-
|
9
|
-
-
|
10
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
data/.rubocop.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
+
inherit_gem:
|
2
|
+
manageiq-style: ".rubocop_base.yml"
|
1
3
|
inherit_from:
|
2
|
-
-
|
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
data/.rubocop_local.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
# GlobalVars:
|
1
|
+
# Style/GlobalVars:
|
2
2
|
# AllowedVariables:
|
data/.travis.yml
CHANGED
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-
|
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.
|
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
|
-
|
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
|
data/bin/appliance_console
CHANGED
@@ -13,7 +13,7 @@ require 'highline/system_extensions'
|
|
13
13
|
require 'rubygems'
|
14
14
|
require 'bcrypt'
|
15
15
|
require 'linux_admin'
|
16
|
-
require '
|
16
|
+
require 'manageiq/appliance_console/postgres_admin'
|
17
17
|
require 'awesome_spawn'
|
18
18
|
include HighLine::SystemExtensions
|
19
19
|
|
@@ -384,13 +384,14 @@ Static Network Configuration
|
|
384
384
|
"Create Region in External Database" => "create_external",
|
385
385
|
"Join Region in External Database" => "join_external",
|
386
386
|
"Reset Configured Database" => "reset_region",
|
387
|
-
"No
|
387
|
+
"Make No Database Changes" => "no_changes"
|
388
388
|
}
|
389
389
|
database_action = ask_with_menu("Database Operation", options)
|
390
390
|
|
391
391
|
messaging_options = {
|
392
|
-
"
|
393
|
-
"
|
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"
|
394
395
|
}
|
395
396
|
|
396
397
|
messaging_action = ask_with_menu("Configure Messaging", messaging_options)
|
@@ -420,8 +421,31 @@ Static Network Configuration
|
|
420
421
|
region = ManageIQ::ApplianceConsole::DatabaseConfiguration.region
|
421
422
|
|
422
423
|
case messaging_action
|
423
|
-
when "
|
424
|
-
|
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
|
425
449
|
end
|
426
450
|
|
427
451
|
press_any_key
|
@@ -38,7 +38,23 @@ module ApplianceConsole
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def database?
|
41
|
-
options[:standalone] || hostname
|
41
|
+
(options[:standalone] || hostname) && !database_admin?
|
42
|
+
end
|
43
|
+
|
44
|
+
def database_admin?
|
45
|
+
db_dump? || db_backup? || db_restore?
|
46
|
+
end
|
47
|
+
|
48
|
+
def db_dump?
|
49
|
+
options[:dump]
|
50
|
+
end
|
51
|
+
|
52
|
+
def db_backup?
|
53
|
+
options[:backup]
|
54
|
+
end
|
55
|
+
|
56
|
+
def db_restore?
|
57
|
+
options[:restore]
|
42
58
|
end
|
43
59
|
|
44
60
|
def local_database?
|
@@ -77,6 +93,22 @@ module ApplianceConsole
|
|
77
93
|
options[:saml_unconfig]
|
78
94
|
end
|
79
95
|
|
96
|
+
def message_server_config?
|
97
|
+
options[:message_server_config]
|
98
|
+
end
|
99
|
+
|
100
|
+
def message_server_unconfig?
|
101
|
+
options[:message_server_unconfig]
|
102
|
+
end
|
103
|
+
|
104
|
+
def message_client_config?
|
105
|
+
options[:message_client_config]
|
106
|
+
end
|
107
|
+
|
108
|
+
def message_client_unconfig?
|
109
|
+
options[:message_client_unconfig]
|
110
|
+
end
|
111
|
+
|
80
112
|
def oidc_config?
|
81
113
|
options[:oidc_config]
|
82
114
|
end
|
@@ -101,10 +133,6 @@ module ApplianceConsole
|
|
101
133
|
options[:openscap]
|
102
134
|
end
|
103
135
|
|
104
|
-
def configure_messaging?
|
105
|
-
options[:messaging_hostname] && options[:messaging_password] && options[:messaging_port] && options[:messaging_username]
|
106
|
-
end
|
107
|
-
|
108
136
|
def initialize(options = {})
|
109
137
|
self.options = options
|
110
138
|
end
|
@@ -127,72 +155,101 @@ module ApplianceConsole
|
|
127
155
|
self.options = Optimist.options(args) do
|
128
156
|
banner "Usage: appliance_console_cli [options]"
|
129
157
|
|
130
|
-
opt :host,
|
131
|
-
opt :region,
|
132
|
-
opt :internal,
|
133
|
-
opt :hostname,
|
134
|
-
opt :port,
|
135
|
-
opt :username,
|
136
|
-
opt :password,
|
137
|
-
opt :dbname,
|
138
|
-
opt :
|
139
|
-
opt :
|
140
|
-
opt :
|
141
|
-
opt :
|
142
|
-
opt :
|
143
|
-
opt :
|
144
|
-
opt :
|
145
|
-
opt :
|
146
|
-
opt :
|
147
|
-
opt :
|
148
|
-
opt :
|
149
|
-
opt :
|
150
|
-
opt :
|
151
|
-
opt :
|
152
|
-
opt :
|
153
|
-
opt :
|
154
|
-
opt :
|
155
|
-
opt :
|
156
|
-
opt :
|
157
|
-
opt :
|
158
|
-
opt :
|
159
|
-
opt :
|
160
|
-
opt :
|
161
|
-
opt :
|
162
|
-
opt :
|
163
|
-
opt :
|
164
|
-
opt :
|
165
|
-
opt :
|
166
|
-
opt :
|
167
|
-
opt :
|
168
|
-
opt :
|
169
|
-
opt :
|
170
|
-
opt :
|
171
|
-
opt :
|
172
|
-
opt :
|
173
|
-
opt :
|
174
|
-
opt :
|
175
|
-
opt :
|
176
|
-
opt :
|
177
|
-
opt :
|
178
|
-
opt :
|
179
|
-
opt :
|
180
|
-
opt :
|
158
|
+
opt :host, "/etc/hosts name", :type => :string, :short => 'H'
|
159
|
+
opt :region, "Region Number", :type => :integer, :short => "r"
|
160
|
+
opt :internal, "Internal Database", :short => 'i'
|
161
|
+
opt :hostname, "Database Hostname", :type => :string, :short => 'h'
|
162
|
+
opt :port, "Database Port", :type => :integer, :default => 5432
|
163
|
+
opt :username, "Database Username", :type => :string, :short => 'U', :default => "root"
|
164
|
+
opt :password, "Database Password", :type => :string, :short => "p"
|
165
|
+
opt :dbname, "Database Name", :type => :string, :short => "d", :default => "vmdb_production"
|
166
|
+
opt :local_file, "Source/Destination file for DB dump/backup/restore", :type => :string, :shoft => "l"
|
167
|
+
opt :dump, "Perform a pg-dump"
|
168
|
+
opt :backup, "Perform a pg-basebackup"
|
169
|
+
opt :restore, "Restore a database dump/backup"
|
170
|
+
opt :standalone, "Run this server as a standalone database server", :type => :bool, :short => 'S'
|
171
|
+
opt :key, "Create encryption key", :type => :boolean, :short => "k"
|
172
|
+
opt :fetch_key, "SSH host with encryption key", :type => :string, :short => "K"
|
173
|
+
opt :force_key, "Forcefully create encryption key", :type => :boolean, :short => "f"
|
174
|
+
opt :sshlogin, "SSH login", :type => :string, :default => "root"
|
175
|
+
opt :sshpassword, "SSH password", :type => :string
|
176
|
+
opt :replication, "Configure database replication as primary or standby", :type => :string, :short => :none
|
177
|
+
opt :primary_host, "Primary database host IP address", :type => :string, :short => :none
|
178
|
+
opt :standby_host, "Standby database host IP address", :type => :string, :short => :none
|
179
|
+
opt :auto_failover, "Configure Replication Manager (repmgrd) for automatic failover", :type => :bool, :short => :none
|
180
|
+
opt :cluster_node_number, "Database unique cluster node number", :type => :integer, :short => :none
|
181
|
+
opt :verbose, "Verbose", :type => :boolean, :short => "v"
|
182
|
+
opt :dbdisk, "Database Disk Path", :type => :string
|
183
|
+
opt :logdisk, "Log Disk Path", :type => :string
|
184
|
+
opt :tmpdisk, "Temp storage Disk Path", :type => :string
|
185
|
+
opt :uninstall_ipa, "Uninstall IPA Client", :type => :boolean, :default => false
|
186
|
+
opt :ipaserver, "IPA Server FQDN", :type => :string
|
187
|
+
opt :ipaprincipal, "IPA Server principal", :type => :string, :default => "admin"
|
188
|
+
opt :ipapassword, "IPA Server password", :type => :string
|
189
|
+
opt :ipadomain, "IPA Server domain (optional)", :type => :string
|
190
|
+
opt :iparealm, "IPA Server realm (optional)", :type => :string
|
191
|
+
opt :ca, "CA name used for certmonger", :type => :string, :default => "ipa"
|
192
|
+
opt :http_cert, "install certs for http server", :type => :boolean
|
193
|
+
opt :extauth_opts, "External Authentication Options", :type => :string
|
194
|
+
opt :saml_config, "Configure Appliance for SAML Authentication", :type => :boolean, :default => false
|
195
|
+
opt :saml_client_host, "Optional Appliance host used for SAML registration", :type => :string
|
196
|
+
opt :saml_idp_metadata, "The file path or URL of the SAML IDP Metadata", :type => :string
|
197
|
+
opt :saml_enable_sso, "Optionally enable SSO with SAML Authentication", :type => :boolean, :default => false
|
198
|
+
opt :saml_unconfig, "Unconfigure Appliance SAML Authentication", :type => :boolean, :default => false
|
199
|
+
opt :oidc_config, "Configure Appliance for OpenID-Connect Authentication", :type => :boolean, :default => false
|
200
|
+
opt :oidc_url, "The OpenID-Connect Provider URL", :type => :string
|
201
|
+
opt :oidc_client_host, "Optional Appliance host used for OpenID-Connect Authentication", :type => :string
|
202
|
+
opt :oidc_client_id, "The OpenID-Connect Provider Client ID", :type => :string
|
203
|
+
opt :oidc_client_secret, "The OpenID-Connect Provider Client Secret", :type => :string
|
204
|
+
opt :oidc_insecure, "OpenID-Connect Insecure No SSL Verify (development)", :type => :boolean, :default => false
|
205
|
+
opt :oidc_introspection_endpoint, "The OpenID-Connect Provider Introspect Endpoint", :type => :string
|
206
|
+
opt :oidc_enable_sso, "Optionally enable SSO with OpenID-Connect Authentication", :type => :boolean, :default => false
|
207
|
+
opt :oidc_unconfig, "Unconfigure Appliance OpenID-Connect Authentication", :type => :boolean, :default => false
|
208
|
+
opt :server, "{start|stop|restart} actions on evmserverd Server", :type => :string
|
209
|
+
opt :openscap, "Setup OpenScap", :type => :boolean, :default => false
|
210
|
+
opt :message_server_config, "Subcommand to Configure Appliance as a Kafka Message Server", :type => :boolean, :default => false
|
211
|
+
opt :message_server_unconfig, "Subcommand to Unconfigure Appliance as a Kafka Message Server", :type => :boolean, :default => false
|
212
|
+
opt :message_client_config, "Subcommand to Configure Appliance as a Kafka Message Client", :type => :boolean, :default => false
|
213
|
+
opt :message_client_unconfig, "Subcommand to Unconfigure Appliance as a Kafka Message Client", :type => :boolean, :default => false
|
214
|
+
opt :message_keystore_username, "Message Server Keystore Username", :type => :string
|
215
|
+
opt :message_keystore_password, "Message Server Keystore Password", :type => :string
|
216
|
+
opt :message_server_username, "Message Server Username", :type => :string
|
217
|
+
opt :message_server_password, "Message Server password", :type => :string
|
218
|
+
opt :message_server_port, "Message Server Port", :type => :integer
|
219
|
+
opt :message_server_use_ipaddr, "Message Server Use Address", :type => :boolean, :default => false
|
220
|
+
opt :message_server_host, "Message Server Hostname or IP Address", :type => :string
|
221
|
+
opt :message_truststore_path_src, "Message Server Truststore Path", :type => :string
|
222
|
+
opt :message_ca_cert_path_src, "Message Server CA Cert Path", :type => :string
|
223
|
+
opt :message_persistent_disk, "Message Persistent Disk Path", :type => :string
|
181
224
|
end
|
182
225
|
Optimist.die :region, "needed when setting up a local database" if region_number_required? && options[:region].nil?
|
226
|
+
Optimist.die "Supply only one of --message-server-host or --message-server-use-ipaddr=true" if both_host_and_use_ip_addr_specified?
|
227
|
+
Optimist.die "Supply only one of --message-server-config, --message-server-unconfig, --message-client-config or --message-client-unconfig" if multiple_message_subcommands?
|
183
228
|
self
|
184
229
|
end
|
185
230
|
|
231
|
+
def both_host_and_use_ip_addr_specified?
|
232
|
+
!options[:message_server_host].nil? && options[:message_server_use_ipaddr] == true
|
233
|
+
end
|
234
|
+
|
235
|
+
def multiple_message_subcommands?
|
236
|
+
a = [options[:message_server_config], options[:message_server_unconfig], options[:message_client_config], options[:message_client_unconfig]]
|
237
|
+
a.each_with_object(Hash.new(0)) { |o, h| h[o] += 1 }[true] > 1
|
238
|
+
end
|
239
|
+
|
186
240
|
def region_number_required?
|
187
|
-
!options[:standalone] && local_database?
|
241
|
+
!options[:standalone] && local_database? && !database_admin?
|
188
242
|
end
|
189
243
|
|
190
244
|
def run
|
191
|
-
Optimist.educate unless set_host? || key? || database? ||
|
245
|
+
Optimist.educate unless set_host? || key? || database? || db_dump? || db_backup? ||
|
246
|
+
db_restore? || tmp_disk? || log_disk? ||
|
192
247
|
uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
|
193
248
|
set_server_state? || set_replication? || openscap? ||
|
194
249
|
saml_config? || saml_unconfig? ||
|
195
|
-
oidc_config? || oidc_unconfig? ||
|
250
|
+
oidc_config? || oidc_unconfig? ||
|
251
|
+
message_server_config? || message_server_unconfig? ||
|
252
|
+
message_client_config? || message_client_unconfig?
|
196
253
|
|
197
254
|
if set_host?
|
198
255
|
system_hosts = LinuxAdmin::Hosts.new
|
@@ -204,6 +261,9 @@ module ApplianceConsole
|
|
204
261
|
create_key if key?
|
205
262
|
set_db if database?
|
206
263
|
set_replication if set_replication?
|
264
|
+
db_dump if db_dump?
|
265
|
+
db_backup if db_backup?
|
266
|
+
db_restore if db_restore?
|
207
267
|
config_tmp_disk if tmp_disk?
|
208
268
|
config_log_disk if log_disk?
|
209
269
|
uninstall_ipa if uninstall_ipa?
|
@@ -216,7 +276,10 @@ module ApplianceConsole
|
|
216
276
|
oidc_unconfig if oidc_unconfig?
|
217
277
|
set_server_state if set_server_state?
|
218
278
|
openscap if openscap?
|
219
|
-
|
279
|
+
message_server_config if message_server_config?
|
280
|
+
message_server_unconfig if message_server_unconfig?
|
281
|
+
message_client_config if message_client_config?
|
282
|
+
message_client_unconfig if message_client_unconfig?
|
220
283
|
rescue CliError => e
|
221
284
|
say(e.message)
|
222
285
|
say("")
|
@@ -305,6 +368,33 @@ module ApplianceConsole
|
|
305
368
|
db_replication.activate
|
306
369
|
end
|
307
370
|
|
371
|
+
def db_dump
|
372
|
+
PostgresAdmin.backup_pg_dump(extract_db_opts(options))
|
373
|
+
end
|
374
|
+
|
375
|
+
def db_backup
|
376
|
+
PostgresAdmin.backup(extract_db_opts(options))
|
377
|
+
end
|
378
|
+
|
379
|
+
def db_restore
|
380
|
+
PostgresAdmin.restore(extract_db_opts(options))
|
381
|
+
end
|
382
|
+
|
383
|
+
DB_OPT_KEYS = %i[dbname username password hostname port local_file].freeze
|
384
|
+
def extract_db_opts(options)
|
385
|
+
require 'manageiq/appliance_console/postgres_admin'
|
386
|
+
|
387
|
+
db_opts = {}
|
388
|
+
|
389
|
+
DB_OPT_KEYS.each { |k| db_opts[k] = options[k] if options[k] }
|
390
|
+
|
391
|
+
if db_dump? && options[:exclude_table_data]
|
392
|
+
db_opts[:exclude_table_data] = options[:exclude_table_data]
|
393
|
+
end
|
394
|
+
|
395
|
+
db_opts
|
396
|
+
end
|
397
|
+
|
308
398
|
def key_configuration
|
309
399
|
@key_configuration ||= KeyConfiguration.new(
|
310
400
|
:action => options[:fetch_key] ? :fetch : :create,
|
@@ -418,6 +508,22 @@ module ApplianceConsole
|
|
418
508
|
OIDCAuthentication.new(options).unconfigure
|
419
509
|
end
|
420
510
|
|
511
|
+
def message_server_config
|
512
|
+
MessageServerConfiguration.new(options).configure
|
513
|
+
end
|
514
|
+
|
515
|
+
def message_server_unconfig
|
516
|
+
MessageServerConfiguration.new(options).unconfigure
|
517
|
+
end
|
518
|
+
|
519
|
+
def message_client_config
|
520
|
+
MessageClientConfiguration.new(options).configure
|
521
|
+
end
|
522
|
+
|
523
|
+
def message_client_unconfig
|
524
|
+
MessageClientConfiguration.new(options).unconfigure
|
525
|
+
end
|
526
|
+
|
421
527
|
def set_server_state
|
422
528
|
service = LinuxAdmin::Service.new("evmserverd")
|
423
529
|
service_running = service.running?
|
@@ -436,16 +542,6 @@ module ApplianceConsole
|
|
436
542
|
def self.parse(args)
|
437
543
|
new.parse(args).run
|
438
544
|
end
|
439
|
-
|
440
|
-
def configure_messaging
|
441
|
-
say("configuring messaging")
|
442
|
-
ManageIQ::ApplianceConsole::MessagingConfiguration.new.save(
|
443
|
-
"hostname" => options[:messaging_hostname],
|
444
|
-
"password" => options[:messaging_password],
|
445
|
-
"port" => options[:messaging_port],
|
446
|
-
"username" => options[:messaging_username]
|
447
|
-
)
|
448
|
-
end
|
449
545
|
end
|
450
546
|
end
|
451
547
|
end
|