manageiq-appliance_console 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +1 -1
- data/bin/appliance_console +2 -2
- data/lib/manageiq-appliance_console.rb +1 -0
- data/lib/manageiq/appliance_console/cli.rb +45 -5
- data/lib/manageiq/appliance_console/database_configuration.rb +2 -1
- data/lib/manageiq/appliance_console/database_replication.rb +5 -4
- data/lib/manageiq/appliance_console/internal_database_configuration.rb +2 -2
- data/lib/manageiq/appliance_console/prompts.rb +3 -4
- data/lib/manageiq/appliance_console/version.rb +1 -1
- data/manageiq-appliance_console.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ab0a7cbd85921dd1332fbaa9b01329e3bc2a5197be9e12ea928f9737ee499003
|
4
|
+
data.tar.gz: 9a8fd3d5d58239eec4c21ce7efb4ecb2546215b7e0f66ec2a14c2f6fe81e66b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed57328bff42362e4a51920baa3268ed3a2d8d6e16a8b0da493eec419c65e05763ba820a0e195b61279bc521f4c012d0a5246fb9ebeacc5354543d89136eb8bd
|
7
|
+
data.tar.gz: 80e710fa562abca7f2a935b9828ebc91841730f9eac789214a35bc64439e011b07918cfea629649d11519eee676bd6264b404e6762b7ce3d6bbbaf94d372f824
|
data/.travis.yml
CHANGED
data/bin/appliance_console
CHANGED
@@ -173,7 +173,7 @@ To modify the configuration, use a web browser to access the management page.
|
|
173
173
|
new_mask = ask_for_ipv4("Netmask", mask)
|
174
174
|
new_gw = ask_for_ipv4("Gateway", gw)
|
175
175
|
new_dns1 = ask_for_ipv4("Primary DNS", dns1)
|
176
|
-
new_dns2 = ask_for_ipv4_or_none("Secondary DNS (Enter 'none' for no value)")
|
176
|
+
new_dns2 = ask_for_ipv4_or_none("Secondary DNS (Enter 'none' for no value)", dns2)
|
177
177
|
|
178
178
|
new_search_order = ask_for_many("domain", "Domain search order", order)
|
179
179
|
|
@@ -225,7 +225,7 @@ Static Network Configuration
|
|
225
225
|
new_prefix = ask_for_integer('IPv6 prefix length', 1..127, eth0.prefix6 || 64)
|
226
226
|
new_gw = ask_for_ipv6('Default gateway', eth0.gateway6)
|
227
227
|
new_dns1 = ask_for_ip('Primary DNS', dns1)
|
228
|
-
new_dns2 = ask_for_ipv6_or_none("Secondary DNS (Enter 'none' for no value)")
|
228
|
+
new_dns2 = ask_for_ipv6_or_none("Secondary DNS (Enter 'none' for no value)", dns2)
|
229
229
|
|
230
230
|
new_search_order = ask_for_many('domain', 'Domain search order', order)
|
231
231
|
|
@@ -24,6 +24,7 @@ require 'manageiq/appliance_console/logger'
|
|
24
24
|
require 'manageiq/appliance_console/logging'
|
25
25
|
|
26
26
|
require 'manageiq-gems-pending'
|
27
|
+
require 'highline'
|
27
28
|
|
28
29
|
require 'manageiq/appliance_console/certificate'
|
29
30
|
require 'manageiq/appliance_console/certificate_authority'
|
@@ -36,11 +36,11 @@ module ApplianceConsole
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def database?
|
39
|
-
hostname
|
39
|
+
options[:standalone] || hostname
|
40
40
|
end
|
41
41
|
|
42
42
|
def local_database?
|
43
|
-
database? && local?(hostname)
|
43
|
+
database? && (local?(hostname) || options[:standalone])
|
44
44
|
end
|
45
45
|
|
46
46
|
def certs?
|
@@ -79,6 +79,14 @@ module ApplianceConsole
|
|
79
79
|
options[:db_hourly_maintenance]
|
80
80
|
end
|
81
81
|
|
82
|
+
def set_replication?
|
83
|
+
options[:cluster_node_number] && options[:password] && replication_params?
|
84
|
+
end
|
85
|
+
|
86
|
+
def replication_params?
|
87
|
+
options[:replication] == "primary" || (options[:replication] == "standby" && options[:primary_host])
|
88
|
+
end
|
89
|
+
|
82
90
|
def initialize(options = {})
|
83
91
|
self.options = options
|
84
92
|
end
|
@@ -116,6 +124,11 @@ module ApplianceConsole
|
|
116
124
|
opt :force_key, "Forcefully create encryption key", :type => :boolean, :short => "f"
|
117
125
|
opt :sshlogin, "SSH login", :type => :string, :default => "root"
|
118
126
|
opt :sshpassword, "SSH password", :type => :string
|
127
|
+
opt :replication, "Configure database replication as primary or standby", :type => :string, :short => :none
|
128
|
+
opt :primary_host, "Primary database host IP address", :type => :string, :short => :none
|
129
|
+
opt :standby_host, "Standby database host IP address", :type => :string, :short => :none
|
130
|
+
opt :auto_failover, "Configure Replication Manager (repmgrd) for automatic failover", :type => :bool, :short => :none
|
131
|
+
opt :cluster_node_number, "Database unique cluster node number", :type => :integer, :short => :none
|
119
132
|
opt :verbose, "Verbose", :type => :boolean, :short => "v"
|
120
133
|
opt :dbdisk, "Database Disk Path", :type => :string
|
121
134
|
opt :logdisk, "Log Disk Path", :type => :string
|
@@ -134,14 +147,19 @@ module ApplianceConsole
|
|
134
147
|
opt :extauth_opts, "External Authentication Options", :type => :string
|
135
148
|
opt :server, "Server status", :type => :string
|
136
149
|
end
|
137
|
-
Trollop.die :region, "needed when setting up a local database" if options[:region].nil?
|
150
|
+
Trollop.die :region, "needed when setting up a local database" if region_number_required? && options[:region].nil?
|
138
151
|
self
|
139
152
|
end
|
140
153
|
|
154
|
+
def region_number_required?
|
155
|
+
!options[:standalone] && local_database?
|
156
|
+
end
|
157
|
+
|
141
158
|
def run
|
142
159
|
Trollop.educate unless set_host? || key? || database? || tmp_disk? || log_disk? ||
|
143
160
|
uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
|
144
|
-
time_zone? || set_server_state? || db_hourly_maintenance?
|
161
|
+
time_zone? || set_server_state? || db_hourly_maintenance? ||
|
162
|
+
set_replication?
|
145
163
|
if set_host?
|
146
164
|
system_hosts = LinuxAdmin::Hosts.new
|
147
165
|
system_hosts.hostname = options[:host]
|
@@ -151,6 +169,7 @@ module ApplianceConsole
|
|
151
169
|
end
|
152
170
|
create_key if key?
|
153
171
|
set_db if database?
|
172
|
+
set_replication if set_replication?
|
154
173
|
set_time_zone if time_zone?
|
155
174
|
config_db_hourly_maintenance if db_hourly_maintenance?
|
156
175
|
config_tmp_disk if tmp_disk?
|
@@ -232,8 +251,28 @@ module ApplianceConsole
|
|
232
251
|
config.post_activation
|
233
252
|
end
|
234
253
|
|
254
|
+
def set_replication
|
255
|
+
if options[:replication] == "primary"
|
256
|
+
db_replication = ManageIQ::ApplianceConsole::DatabaseReplicationPrimary.new
|
257
|
+
say("Configuring Server as Primary")
|
258
|
+
else
|
259
|
+
db_replication = ManageIQ::ApplianceConsole::DatabaseReplicationStandby.new
|
260
|
+
say("Configuring Server as Standby")
|
261
|
+
db_replication.disk = disk_from_string(options[:dbdisk])
|
262
|
+
db_replication.primary_host = options[:primary_host]
|
263
|
+
db_replication.standby_host = options[:standby_host] if options[:standby_host]
|
264
|
+
db_replication.run_repmgrd_configuration = options[:auto_failover] ? true : false
|
265
|
+
end
|
266
|
+
db_replication.database_name = options[:dbname] if options[:dbname]
|
267
|
+
db_replication.database_user = options[:username] if options[:username]
|
268
|
+
db_replication.node_number = options[:cluster_node_number]
|
269
|
+
db_replication.database_password = options[:password]
|
270
|
+
db_replication.activate
|
271
|
+
end
|
272
|
+
|
235
273
|
def set_time_zone
|
236
274
|
timezone_config = ManageIQ::ApplianceConsole::TimezoneConfiguration.new(options[:timezone])
|
275
|
+
timezone_config.new_timezone = options[:timezone]
|
237
276
|
if timezone_config.activate
|
238
277
|
say("Timezone configured")
|
239
278
|
else
|
@@ -254,7 +293,8 @@ module ApplianceConsole
|
|
254
293
|
def create_key
|
255
294
|
say "#{key_configuration.action} encryption key"
|
256
295
|
unless key_configuration.activate
|
257
|
-
|
296
|
+
say("Could not create encryption key (v2_key)")
|
297
|
+
exit(1)
|
258
298
|
end
|
259
299
|
end
|
260
300
|
|
@@ -80,7 +80,8 @@ module ApplianceConsole
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def create_region
|
83
|
-
|
83
|
+
hint = "Please stop the EVM server process on all appliances in the region"
|
84
|
+
ManageIQ::ApplianceConsole::Utilities.bail_if_db_connections("preventing the setup of a database region.\n#{hint}")
|
84
85
|
log_and_feedback(__method__) do
|
85
86
|
ManageIQ::ApplianceConsole::Utilities.rake("evm:db:region", ["--", {:region => region}])
|
86
87
|
end
|
@@ -6,9 +6,10 @@ module ApplianceConsole
|
|
6
6
|
class DatabaseReplication
|
7
7
|
include ManageIQ::ApplianceConsole::Logging
|
8
8
|
|
9
|
-
REPMGR_CONFIG
|
10
|
-
REPMGR_LOG
|
11
|
-
PGPASS_FILE
|
9
|
+
REPMGR_CONFIG = '/etc/repmgr.conf'.freeze
|
10
|
+
REPMGR_LOG = '/var/log/repmgr/repmgrd.log'.freeze
|
11
|
+
PGPASS_FILE = '/var/lib/pgsql/.pgpass'.freeze
|
12
|
+
NETWORK_INTERFACE = 'eth0'.freeze
|
12
13
|
|
13
14
|
attr_accessor :cluster_name, :node_number, :database_name, :database_user,
|
14
15
|
:database_password, :primary_host
|
@@ -71,7 +72,7 @@ Replication Server Configuration
|
|
71
72
|
primary_region_number =
|
72
73
|
pg_conn.exec("SELECT last_value FROM miq_databases_id_seq").first["last_value"].to_i / 1_000_000_000_000
|
73
74
|
self.cluster_name = "miq_region_#{primary_region_number}_cluster"
|
74
|
-
rescue PG::ConnectionBad => e
|
75
|
+
rescue PG::ConnectionBad, PG::UndefinedTable => e
|
75
76
|
say("Failed to get primary region number #{e.message}")
|
76
77
|
logger.error("Failed to get primary region number #{e.message}")
|
77
78
|
return false
|
@@ -65,11 +65,11 @@ module ApplianceConsole
|
|
65
65
|
end
|
66
66
|
|
67
67
|
def choose_disk
|
68
|
-
@disk = ask_for_disk("database disk")
|
68
|
+
@disk = ask_for_disk("database disk", false, true)
|
69
69
|
end
|
70
70
|
|
71
71
|
def check_disk_is_mount_point
|
72
|
-
error_message = "
|
72
|
+
error_message = "Internal databases require a volume mounted at #{mount_point}. Please add an unpartitioned disk and try again."
|
73
73
|
raise error_message unless disk || pg_mount_point?
|
74
74
|
end
|
75
75
|
|
@@ -144,12 +144,12 @@ module ApplianceConsole
|
|
144
144
|
just_ask(prompt, default, INT_REGEXP, "an integer", Integer) { |q| q.in = range if range }
|
145
145
|
end
|
146
146
|
|
147
|
-
def ask_for_disk(disk_name, verify = true)
|
147
|
+
def ask_for_disk(disk_name, verify = true, silent = false)
|
148
148
|
require "linux_admin"
|
149
149
|
disks = LinuxAdmin::Disk.local.select { |d| d.partitions.empty? }
|
150
150
|
|
151
151
|
if disks.empty?
|
152
|
-
say
|
152
|
+
say("No partition found for #{disk_name}. You probably want to add an unpartitioned disk and try again.") unless silent
|
153
153
|
else
|
154
154
|
default_choice = disks.size == 1 ? "1" : nil
|
155
155
|
disk = ask_with_menu(
|
@@ -160,9 +160,8 @@ module ApplianceConsole
|
|
160
160
|
q.choice("Don't partition the disk") { nil }
|
161
161
|
end
|
162
162
|
end
|
163
|
-
|
164
163
|
if verify && disk.nil?
|
165
|
-
say
|
164
|
+
say("")
|
166
165
|
raise MiqSignalError unless are_you_sure?(" you don't want to partition the #{disk_name}")
|
167
166
|
end
|
168
167
|
disk
|
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_runtime_dependency "activerecord"
|
24
|
-
spec.add_runtime_dependency "activesupport"
|
23
|
+
spec.add_runtime_dependency "activerecord", ">= 4.2.2"
|
24
|
+
spec.add_runtime_dependency "activesupport", ">= 4.2.2"
|
25
25
|
spec.add_runtime_dependency "awesome_spawn", "~> 1.4"
|
26
26
|
spec.add_runtime_dependency "bcrypt", "~> 3.1.10"
|
27
27
|
spec.add_runtime_dependency "highline", "~> 1.6.21"
|
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: 1.0
|
4
|
+
version: 1.1.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: 2017-
|
11
|
+
date: 2017-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 4.2.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 4.2.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activesupport
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 4.2.2
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 4.2.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: awesome_spawn
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -296,7 +296,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
296
|
version: '0'
|
297
297
|
requirements: []
|
298
298
|
rubyforge_project:
|
299
|
-
rubygems_version: 2.
|
299
|
+
rubygems_version: 2.7.2
|
300
300
|
signing_key:
|
301
301
|
specification_version: 4
|
302
302
|
summary: ManageIQ Appliance Console
|