manageiq-appliance_console 3.3.3 → 4.0.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 +4 -4
- data/Gemfile +1 -1
- data/lib/manageiq/appliance_console/certificate.rb +26 -0
- data/lib/manageiq/appliance_console/certificate_authority.rb +11 -2
- data/lib/manageiq/appliance_console/cli.rb +14 -13
- data/lib/manageiq/appliance_console/database_replication.rb +2 -2
- data/lib/manageiq/appliance_console/database_replication_standby.rb +1 -1
- data/lib/manageiq/appliance_console/internal_database_configuration.rb +1 -1
- data/lib/manageiq/appliance_console/logical_volume_management.rb +13 -16
- data/lib/manageiq/appliance_console/version.rb +1 -1
- data/manageiq-appliance_console.gemspec +2 -2
- metadata +16 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ae45795759924ffcb767e88c968847a8ab4668ca7e300bee23862e1b5cbc9be
|
4
|
+
data.tar.gz: 2b681236da45dc65576e2a0779aaa9179ac1f04079f1f2c7982bdb5923b75da0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f76a5c46f96ea86a1d31376008ef8692fc1006a7f2082ea5d8815df1415a7974a0a9924592070291661c634d4d8fb156e2296855ebd38bac44ec494ad575d05
|
7
|
+
data.tar.gz: 379e0487991063ecc85c6b24b58d68712d72bb71d7212254775f18a1b7b6d9c2cce3056da46b38c9be12c65e79b26107463236cd688bffb570c4d4707db8e197
|
data/Gemfile
CHANGED
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in manageiq-smartstate.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem "manageiq-gems-pending", :git => "https://github.com/ManageIQ/manageiq-gems-pending", :branch => "
|
6
|
+
gem "manageiq-gems-pending", :git => "https://github.com/ManageIQ/manageiq-gems-pending", :branch => "master"
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require "awesome_spawn"
|
2
|
+
require "linux_admin"
|
3
|
+
require "fileutils"
|
2
4
|
|
3
5
|
module ManageIQ
|
4
6
|
module ApplianceConsole
|
@@ -39,8 +41,11 @@ module ApplianceConsole
|
|
39
41
|
end
|
40
42
|
|
41
43
|
def request
|
44
|
+
undo_tracking if complete?
|
45
|
+
|
42
46
|
if should_request_key?
|
43
47
|
principal.register
|
48
|
+
remove_key_pair
|
44
49
|
request_certificate
|
45
50
|
# NOTE: status probably changed
|
46
51
|
set_owner_of_key unless rejected?
|
@@ -103,8 +108,29 @@ module ApplianceConsole
|
|
103
108
|
@status ||= key_status
|
104
109
|
end
|
105
110
|
|
111
|
+
def enable_certmonger
|
112
|
+
say("enabling certmonger to start on reboot")
|
113
|
+
LinuxAdmin::Service.new("certmonger").enable.start
|
114
|
+
end
|
115
|
+
|
106
116
|
private
|
107
117
|
|
118
|
+
def remove_key_pair
|
119
|
+
FileUtils.rm_f(cert_filename) if File.exist?(cert_filename)
|
120
|
+
FileUtils.rm_f(key_filename) if File.exist?(key_filename)
|
121
|
+
end
|
122
|
+
|
123
|
+
def undo_tracking
|
124
|
+
stop_tracking
|
125
|
+
FileUtils.rm_f(root_filename) if File.exist?(root_filename)
|
126
|
+
remove_key_pair
|
127
|
+
clear_status
|
128
|
+
end
|
129
|
+
|
130
|
+
def stop_tracking
|
131
|
+
AwesomeSpawn.run!("/usr/bin/getcert", :params => ["stop-tracking", "-f", cert_filename, "-k", key_filename])
|
132
|
+
end
|
133
|
+
|
108
134
|
def request_first
|
109
135
|
params = {
|
110
136
|
nil => "request",
|
@@ -63,7 +63,7 @@ module ApplianceConsole
|
|
63
63
|
AwesomeSpawn.run!("/sbin/restorecon -R #{PSQL_CLIENT_DIR}")
|
64
64
|
end
|
65
65
|
|
66
|
-
|
66
|
+
cert = Certificate.new(
|
67
67
|
:cert_filename => "#{PSQL_CLIENT_DIR}/postgresql.crt",
|
68
68
|
:root_filename => "#{PSQL_CLIENT_DIR}/root.crt",
|
69
69
|
:service => "manageiq",
|
@@ -71,7 +71,12 @@ module ApplianceConsole
|
|
71
71
|
:ca_name => ca_name,
|
72
72
|
:hostname => hostname,
|
73
73
|
:realm => realm,
|
74
|
-
).request
|
74
|
+
).request
|
75
|
+
|
76
|
+
if cert.complete?
|
77
|
+
cert.enable_certmonger
|
78
|
+
end
|
79
|
+
self.pgclient = cert.status
|
75
80
|
end
|
76
81
|
|
77
82
|
def configure_pgserver
|
@@ -92,6 +97,8 @@ module ApplianceConsole
|
|
92
97
|
# no need for username/password since not writing database.yml
|
93
98
|
InternalDatabaseConfiguration.new(:ssl => true).configure_postgres
|
94
99
|
LinuxAdmin::Service.new(PostgresAdmin.service_name).restart
|
100
|
+
|
101
|
+
cert.enable_certmonger
|
95
102
|
end
|
96
103
|
self.pgserver = cert.status
|
97
104
|
end
|
@@ -110,6 +117,8 @@ module ApplianceConsole
|
|
110
117
|
if cert.complete?
|
111
118
|
say "configuring apache to use new certs"
|
112
119
|
LinuxAdmin::Service.new("httpd").restart
|
120
|
+
|
121
|
+
cert.enable_certmonger
|
113
122
|
end
|
114
123
|
self.http = cert.status
|
115
124
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'optimist'
|
2
2
|
require 'pathname'
|
3
3
|
|
4
4
|
# support for appliance_console methods
|
@@ -10,8 +10,6 @@ end
|
|
10
10
|
|
11
11
|
module ManageIQ
|
12
12
|
module ApplianceConsole
|
13
|
-
class CliError < StandardError; end
|
14
|
-
|
15
13
|
class Cli
|
16
14
|
attr_accessor :options
|
17
15
|
|
@@ -108,7 +106,7 @@ module ApplianceConsole
|
|
108
106
|
|
109
107
|
def parse(args)
|
110
108
|
args.shift if args.first == "--" # Handle when called through script/runner
|
111
|
-
self.options =
|
109
|
+
self.options = Optimist.options(args) do
|
112
110
|
banner "Usage: appliance_console_cli [options]"
|
113
111
|
|
114
112
|
opt :host, "/etc/hosts name", :type => :string, :short => 'H'
|
@@ -149,7 +147,7 @@ module ApplianceConsole
|
|
149
147
|
opt :extauth_opts, "External Authentication Options", :type => :string
|
150
148
|
opt :server, "{start|stop|restart} actions on evmserverd Server", :type => :string
|
151
149
|
end
|
152
|
-
|
150
|
+
Optimist.die :region, "needed when setting up a local database" if region_number_required? && options[:region].nil?
|
153
151
|
self
|
154
152
|
end
|
155
153
|
|
@@ -158,7 +156,7 @@ module ApplianceConsole
|
|
158
156
|
end
|
159
157
|
|
160
158
|
def run
|
161
|
-
|
159
|
+
Optimist.educate unless set_host? || key? || database? || tmp_disk? || log_disk? ||
|
162
160
|
uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
|
163
161
|
time_zone? || date_time? || set_server_state? || set_replication?
|
164
162
|
if set_host?
|
@@ -180,10 +178,6 @@ module ApplianceConsole
|
|
180
178
|
install_certs if certs?
|
181
179
|
extauth_opts if extauth_opts?
|
182
180
|
set_server_state if set_server_state?
|
183
|
-
rescue CliError => e
|
184
|
-
say(e.message)
|
185
|
-
say("")
|
186
|
-
exit(1)
|
187
181
|
rescue AwesomeSpawn::CommandResultError => e
|
188
182
|
say e.result.output
|
189
183
|
say e.result.error
|
@@ -222,12 +216,16 @@ module ApplianceConsole
|
|
222
216
|
# initdb, relabel log directory for selinux, update configs,
|
223
217
|
# start pg, create user, create db update the rails configuration,
|
224
218
|
# verify, set up the database with region. activate does it all!
|
225
|
-
|
219
|
+
unless config.activate
|
220
|
+
say "Failed to configure internal database"
|
221
|
+
return
|
222
|
+
end
|
226
223
|
|
227
224
|
# enable/start related services
|
228
225
|
config.post_activation
|
229
226
|
rescue RuntimeError => e
|
230
|
-
|
227
|
+
say e.message
|
228
|
+
say "Failed to configure internal database"
|
231
229
|
end
|
232
230
|
|
233
231
|
def set_external_db
|
@@ -243,7 +241,10 @@ module ApplianceConsole
|
|
243
241
|
}.delete_if { |_n, v| v.nil? })
|
244
242
|
|
245
243
|
# call create_or_join_region (depends on region value)
|
246
|
-
|
244
|
+
unless config.activate
|
245
|
+
say "Failed to configure external database"
|
246
|
+
return
|
247
|
+
end
|
247
248
|
|
248
249
|
# enable/start related services
|
249
250
|
config.post_activation
|
@@ -7,7 +7,7 @@ module ApplianceConsole
|
|
7
7
|
class DatabaseReplication
|
8
8
|
include ManageIQ::ApplianceConsole::Logging
|
9
9
|
|
10
|
-
REPMGR_CONFIG = '/etc/repmgr.conf'.freeze
|
10
|
+
REPMGR_CONFIG = '/etc/repmgr/10/repmgr.conf'.freeze
|
11
11
|
REPMGR_LOG = '/var/log/repmgr/repmgrd.log'.freeze
|
12
12
|
PGPASS_FILE = '/var/lib/pgsql/.pgpass'.freeze
|
13
13
|
NETWORK_INTERFACE = 'eth0'.freeze
|
@@ -59,7 +59,7 @@ Replication Server Configuration
|
|
59
59
|
node_name=#{host}
|
60
60
|
conninfo='host=#{host} user=#{database_user} dbname=#{database_name}'
|
61
61
|
use_replication_slots=1
|
62
|
-
pg_basebackup_options='--
|
62
|
+
pg_basebackup_options='--wal-method=stream'
|
63
63
|
failover=automatic
|
64
64
|
promote_command='repmgr standby promote -f #{REPMGR_CONFIG} --log-to-file'
|
65
65
|
follow_command='repmgr standby follow -f #{REPMGR_CONFIG} --log-to-file --upstream-node-id=%n'
|
@@ -8,7 +8,7 @@ module ApplianceConsole
|
|
8
8
|
include ManageIQ::ApplianceConsole::Logging
|
9
9
|
|
10
10
|
REGISTER_CMD = 'repmgr standby register'.freeze
|
11
|
-
REPMGRD_SERVICE = '
|
11
|
+
REPMGRD_SERVICE = 'repmgr10'.freeze
|
12
12
|
|
13
13
|
attr_accessor :disk, :standby_host, :run_repmgrd_configuration, :resync_data, :force_register
|
14
14
|
|
@@ -123,7 +123,7 @@ module ApplianceConsole
|
|
123
123
|
end
|
124
124
|
|
125
125
|
def run_initdb
|
126
|
-
AwesomeSpawn.run!("
|
126
|
+
AwesomeSpawn.run!("postgresql-setup", :params => {:initdb => nil, :unit => PostgresAdmin.service_name})
|
127
127
|
end
|
128
128
|
|
129
129
|
def start_postgres
|
@@ -34,9 +34,8 @@ module ApplianceConsole
|
|
34
34
|
create_volume_group
|
35
35
|
create_logical_volume_to_fill_volume_group
|
36
36
|
format_logical_volume
|
37
|
-
update_fstab
|
38
|
-
lazy_unmount_mount_point
|
39
37
|
mount_disk
|
38
|
+
update_fstab
|
40
39
|
end
|
41
40
|
|
42
41
|
private
|
@@ -70,32 +69,30 @@ module ApplianceConsole
|
|
70
69
|
AwesomeSpawn.run!("mkfs.#{filesystem_type} #{logical_volume.path}")
|
71
70
|
end
|
72
71
|
|
73
|
-
def lazy_unmount_mount_point
|
74
|
-
AwesomeSpawn.run!("umount", :params => ["-l", mount_point.to_s]) if File.file?("/proc/mounts") && File.read("/proc/mounts").include?(" #{mount_point} ")
|
75
|
-
end
|
76
|
-
|
77
72
|
def mount_disk
|
78
73
|
if mount_point.symlink?
|
79
74
|
FileUtils.rm_rf(mount_point)
|
80
75
|
FileUtils.mkdir_p(mount_point)
|
81
76
|
end
|
82
|
-
AwesomeSpawn.run!("mount", :params =>
|
77
|
+
AwesomeSpawn.run!("mount", :params => {"-t" => filesystem_type,
|
78
|
+
nil => [logical_volume.path, mount_point]})
|
83
79
|
end
|
84
80
|
|
85
81
|
def update_fstab
|
86
82
|
fstab = LinuxAdmin::FSTab.instance
|
87
|
-
|
88
|
-
fstab.entries.delete(entry)
|
83
|
+
return if fstab.entries.find { |e| e.mount_point == mount_point }
|
89
84
|
|
90
|
-
entry
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
85
|
+
entry = LinuxAdmin::FSTabEntry.new(
|
86
|
+
:device => logical_volume.path,
|
87
|
+
:mount_point => mount_point,
|
88
|
+
:fs_type => filesystem_type,
|
89
|
+
:mount_options => "rw,noatime",
|
90
|
+
:dumpable => 0,
|
91
|
+
:fsck_order => 0
|
92
|
+
)
|
96
93
|
|
97
94
|
fstab.entries << entry
|
98
|
-
fstab.write!
|
95
|
+
fstab.write! # Test this more, whitespace is removed
|
99
96
|
end
|
100
97
|
end
|
101
98
|
end
|
@@ -26,9 +26,9 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_runtime_dependency "bcrypt", "~> 3.1.10"
|
27
27
|
spec.add_runtime_dependency "highline", "~> 1.6.21"
|
28
28
|
spec.add_runtime_dependency "i18n", "~> 0.7"
|
29
|
-
spec.add_runtime_dependency "linux_admin", ["~> 1.0", ">=1.2.
|
29
|
+
spec.add_runtime_dependency "linux_admin", ["~> 1.0", ">=1.2.2"]
|
30
|
+
spec.add_runtime_dependency "optimist", "~> 3.0"
|
30
31
|
spec.add_runtime_dependency "pg"
|
31
|
-
spec.add_runtime_dependency "trollop", "~> 2.0"
|
32
32
|
|
33
33
|
spec.add_development_dependency "bundler"
|
34
34
|
spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
|
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:
|
4
|
+
version: 4.0.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: 2019-
|
11
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -103,7 +103,7 @@ dependencies:
|
|
103
103
|
version: '1.0'
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 1.2.
|
106
|
+
version: 1.2.2
|
107
107
|
type: :runtime
|
108
108
|
prerelease: false
|
109
109
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -113,35 +113,35 @@ dependencies:
|
|
113
113
|
version: '1.0'
|
114
114
|
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 1.2.
|
116
|
+
version: 1.2.2
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
|
-
name:
|
118
|
+
name: optimist
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
|
-
- - "
|
121
|
+
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '0'
|
123
|
+
version: '3.0'
|
124
124
|
type: :runtime
|
125
125
|
prerelease: false
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
127
127
|
requirements:
|
128
|
-
- - "
|
128
|
+
- - "~>"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '0'
|
130
|
+
version: '3.0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
|
-
name:
|
132
|
+
name: pg
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|
134
134
|
requirements:
|
135
|
-
- - "
|
135
|
+
- - ">="
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '
|
137
|
+
version: '0'
|
138
138
|
type: :runtime
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
|
-
- - "
|
142
|
+
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '
|
144
|
+
version: '0'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: bundler
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -301,7 +301,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
|
-
|
304
|
+
rubyforge_project:
|
305
|
+
rubygems_version: 2.7.6
|
305
306
|
signing_key:
|
306
307
|
specification_version: 4
|
307
308
|
summary: ManageIQ Appliance Console
|