manageiq-appliance_console 1.2.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/appliance_console +2 -20
- data/lib/manageiq-appliance_console.rb +0 -3
- data/lib/manageiq/appliance_console/cli.rb +1 -14
- data/lib/manageiq/appliance_console/version.rb +1 -1
- data/locales/appliance/en.yml +0 -1
- data/locales/container/en.yml +0 -1
- metadata +3 -6
- data/lib/manageiq/appliance_console/database_maintenance.rb +0 -35
- data/lib/manageiq/appliance_console/database_maintenance_hourly.rb +0 -58
- data/lib/manageiq/appliance_console/database_maintenance_periodic.rb +0 -84
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 609d69718e3bdb080fb6d13495f193690fcbefd7b84ca025204727d43927d9f9
|
4
|
+
data.tar.gz: 5e97c6a1dd7729a4c7219085bc77577abd90988e4af37f9dc92ca63f9358ec65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 816864476123eaacd5b54c4ff02ed1365ac54cef5818193867aa42522966c29facc28e21bbd7e7cc9ecd8c33358715d626881e70abec830e64f12cd20d70fb1c
|
7
|
+
data.tar.gz: ff74aceb06533ec663a5d24213f33e572e4666d6a4ce9c8abf5450933d82997bb6f135d0413e6cea8527da1c7c647e99f44f71ac071ed9668144d6a2607fb1b0
|
data/bin/appliance_console
CHANGED
@@ -394,14 +394,6 @@ Static Network Configuration
|
|
394
394
|
task_params = []
|
395
395
|
uri = nil
|
396
396
|
|
397
|
-
connections = ManageIQ::ApplianceConsole::Utilities.db_connections - 1
|
398
|
-
if connections > 0
|
399
|
-
say("\nDatabase restore failed")
|
400
|
-
say("\nThere #{connections > 1 ? "are #{connections} connections" : "is 1 connection"} preventing a database restore")
|
401
|
-
press_any_key
|
402
|
-
raise MiqSignalError
|
403
|
-
end
|
404
|
-
|
405
397
|
# TODO: merge into 1 prompt
|
406
398
|
case ask_with_menu("Restore Database File", RESTORE_OPTIONS, RESTORE_LOCAL, nil)
|
407
399
|
when RESTORE_LOCAL
|
@@ -443,6 +435,8 @@ Static Network Configuration
|
|
443
435
|
if rake_success && delete_agreed
|
444
436
|
say("\nRemoving the database restore file #{DB_RESTORE_FILE}...")
|
445
437
|
File.delete(DB_RESTORE_FILE)
|
438
|
+
elsif !rake_success
|
439
|
+
say("\nDatabase restore failed. Check the logs for more information")
|
446
440
|
end
|
447
441
|
end
|
448
442
|
press_any_key
|
@@ -575,18 +569,6 @@ Static Network Configuration
|
|
575
569
|
say("Failover Monitor Service configured successfully")
|
576
570
|
press_any_key
|
577
571
|
|
578
|
-
when I18n.t("advanced_settings.db_maintenance")
|
579
|
-
say("#{selection}\n\n")
|
580
|
-
db_maintenance = ManageIQ::ApplianceConsole::DatabaseMaintenance.new
|
581
|
-
if db_maintenance.ask_questions && db_maintenance.activate
|
582
|
-
say("Database maintenance configuration updated")
|
583
|
-
press_any_key
|
584
|
-
else
|
585
|
-
say("Database maintenance configuration unchanged")
|
586
|
-
press_any_key
|
587
|
-
raise MiqSignalError
|
588
|
-
end
|
589
|
-
|
590
572
|
when I18n.t("advanced_settings.log_config")
|
591
573
|
say("#{selection}\n\n")
|
592
574
|
log_config = ManageIQ::ApplianceConsole::LogfileConfiguration.new
|
@@ -30,9 +30,6 @@ require 'manageiq/appliance_console/certificate'
|
|
30
30
|
require 'manageiq/appliance_console/certificate_authority'
|
31
31
|
require 'manageiq/appliance_console/cli'
|
32
32
|
require 'manageiq/appliance_console/database_configuration'
|
33
|
-
require 'manageiq/appliance_console/database_maintenance'
|
34
|
-
require 'manageiq/appliance_console/database_maintenance_hourly'
|
35
|
-
require 'manageiq/appliance_console/database_maintenance_periodic'
|
36
33
|
require 'manageiq/appliance_console/database_replication'
|
37
34
|
require 'manageiq/appliance_console/database_replication_primary'
|
38
35
|
require 'manageiq/appliance_console/database_replication_standby'
|
@@ -79,10 +79,6 @@ module ApplianceConsole
|
|
79
79
|
options[:server]
|
80
80
|
end
|
81
81
|
|
82
|
-
def db_hourly_maintenance?
|
83
|
-
options[:db_hourly_maintenance]
|
84
|
-
end
|
85
|
-
|
86
82
|
def set_replication?
|
87
83
|
options[:cluster_node_number] && options[:password] && replication_params?
|
88
84
|
end
|
@@ -121,7 +117,6 @@ module ApplianceConsole
|
|
121
117
|
opt :username, "Database Username", :type => :string, :short => 'U', :default => "root"
|
122
118
|
opt :password, "Database Password", :type => :string, :short => "p"
|
123
119
|
opt :dbname, "Database Name", :type => :string, :short => "d", :default => "vmdb_production"
|
124
|
-
opt :db_hourly_maintenance, "Configure database hourly maintenance", :type => :bool, :short => :none
|
125
120
|
opt :standalone, "Run this server as a standalone database server", :type => :bool, :short => 'S'
|
126
121
|
opt :key, "Create encryption key", :type => :boolean, :short => "k"
|
127
122
|
opt :fetch_key, "SSH host with encryption key", :type => :string, :short => "K"
|
@@ -163,8 +158,7 @@ module ApplianceConsole
|
|
163
158
|
def run
|
164
159
|
Trollop.educate unless set_host? || key? || database? || tmp_disk? || log_disk? ||
|
165
160
|
uninstall_ipa? || install_ipa? || certs? || extauth_opts? ||
|
166
|
-
time_zone? || date_time? || set_server_state? ||
|
167
|
-
db_hourly_maintenance? || set_replication?
|
161
|
+
time_zone? || date_time? || set_server_state? || set_replication?
|
168
162
|
if set_host?
|
169
163
|
system_hosts = LinuxAdmin::Hosts.new
|
170
164
|
system_hosts.hostname = options[:host]
|
@@ -177,7 +171,6 @@ module ApplianceConsole
|
|
177
171
|
set_replication if set_replication?
|
178
172
|
set_time_zone if time_zone?
|
179
173
|
set_date_time if date_time?
|
180
|
-
config_db_hourly_maintenance if db_hourly_maintenance?
|
181
174
|
config_tmp_disk if tmp_disk?
|
182
175
|
config_log_disk if log_disk?
|
183
176
|
uninstall_ipa if uninstall_ipa?
|
@@ -415,12 +408,6 @@ module ApplianceConsole
|
|
415
408
|
end
|
416
409
|
end
|
417
410
|
|
418
|
-
def config_db_hourly_maintenance
|
419
|
-
hourly = ManageIQ::ApplianceConsole::DatabaseMaintenanceHourly.new
|
420
|
-
hourly.requested_activate = true
|
421
|
-
hourly.activate
|
422
|
-
end
|
423
|
-
|
424
411
|
def self.parse(args)
|
425
412
|
new.parse(args).run
|
426
413
|
end
|
data/locales/appliance/en.yml
CHANGED
@@ -28,7 +28,6 @@ en:
|
|
28
28
|
dbrestore: Restore Database From Backup
|
29
29
|
db_config: Configure Database
|
30
30
|
db_replication: Configure Database Replication
|
31
|
-
db_maintenance: Configure Database Maintenance
|
32
31
|
log_config: Logfile Configuration
|
33
32
|
failover_monitor: Configure Application Database Failover Monitor
|
34
33
|
httpdauth: Configure External Authentication (httpd)
|
data/locales/container/en.yml
CHANGED
@@ -20,7 +20,6 @@ en:
|
|
20
20
|
dbrestore: Restore Database From Backup
|
21
21
|
db_config: Configure Database
|
22
22
|
db_replication: Configure Database Replication
|
23
|
-
db_maintenance: Configure Database Maintenance
|
24
23
|
failover_monitor: Configure Application Database Failover Monitor
|
25
24
|
evmstop: Stop EVM Server Processes
|
26
25
|
key_gen: Generate Custom Encryption Key
|
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: 2.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: 2018-
|
11
|
+
date: 2018-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -247,9 +247,6 @@ files:
|
|
247
247
|
- lib/manageiq/appliance_console/certificate_authority.rb
|
248
248
|
- lib/manageiq/appliance_console/cli.rb
|
249
249
|
- lib/manageiq/appliance_console/database_configuration.rb
|
250
|
-
- lib/manageiq/appliance_console/database_maintenance.rb
|
251
|
-
- lib/manageiq/appliance_console/database_maintenance_hourly.rb
|
252
|
-
- lib/manageiq/appliance_console/database_maintenance_periodic.rb
|
253
250
|
- lib/manageiq/appliance_console/database_replication.rb
|
254
251
|
- lib/manageiq/appliance_console/database_replication_primary.rb
|
255
252
|
- lib/manageiq/appliance_console/database_replication_standby.rb
|
@@ -296,7 +293,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
293
|
version: '0'
|
297
294
|
requirements: []
|
298
295
|
rubyforge_project:
|
299
|
-
rubygems_version: 2.7.
|
296
|
+
rubygems_version: 2.7.6
|
300
297
|
signing_key:
|
301
298
|
specification_version: 4
|
302
299
|
summary: ManageIQ Appliance Console
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module ManageIQ
|
4
|
-
module ApplianceConsole
|
5
|
-
class DatabaseMaintenance
|
6
|
-
include ManageIQ::ApplianceConsole::Logging
|
7
|
-
|
8
|
-
attr_accessor :hourly, :executed_hourly_action, :requested_hourly_action
|
9
|
-
attr_accessor :periodic, :executed_periodic_action, :requested_periodic_action
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
self.hourly = ManageIQ::ApplianceConsole::DatabaseMaintenanceHourly.new
|
13
|
-
self.periodic = ManageIQ::ApplianceConsole::DatabaseMaintenancePeriodic.new
|
14
|
-
self.requested_hourly_action = false
|
15
|
-
self.requested_periodic_action = false
|
16
|
-
self.executed_hourly_action = false
|
17
|
-
self.executed_periodic_action = false
|
18
|
-
end
|
19
|
-
|
20
|
-
def ask_questions
|
21
|
-
clear_screen
|
22
|
-
self.requested_hourly_action = hourly.confirm
|
23
|
-
self.requested_periodic_action = periodic.confirm
|
24
|
-
requested_hourly_action || requested_periodic_action
|
25
|
-
end
|
26
|
-
|
27
|
-
def activate
|
28
|
-
say("Configuring Database Maintenance...")
|
29
|
-
self.executed_hourly_action = hourly.activate
|
30
|
-
self.executed_periodic_action = periodic.activate
|
31
|
-
executed_hourly_action || executed_periodic_action
|
32
|
-
end
|
33
|
-
end # class DatabaseMaintenance
|
34
|
-
end # module ApplianceConsole
|
35
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
|
3
|
-
module ManageIQ
|
4
|
-
module ApplianceConsole
|
5
|
-
class DatabaseMaintenanceHourly
|
6
|
-
include ManageIQ::ApplianceConsole::Logging
|
7
|
-
|
8
|
-
HOURLY_CRON = "/etc/cron.hourly/miq-pg-maintenance-hourly.cron".freeze
|
9
|
-
|
10
|
-
attr_accessor :already_configured, :requested_deactivate, :requested_activate
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
self.already_configured = File.exist?(HOURLY_CRON)
|
14
|
-
self.requested_deactivate = false
|
15
|
-
self.requested_activate = false
|
16
|
-
end
|
17
|
-
|
18
|
-
def activate
|
19
|
-
return deactivate if requested_deactivate
|
20
|
-
return configure if requested_activate
|
21
|
-
false
|
22
|
-
end
|
23
|
-
|
24
|
-
def confirm
|
25
|
-
if already_configured
|
26
|
-
self.requested_deactivate = agree("Hourly Database Maintenance is already configured, Un-Configure (Y/N):")
|
27
|
-
else
|
28
|
-
self.requested_activate = agree("Configure Hourly Database Maintenance? (Y/N): ")
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
private
|
33
|
-
|
34
|
-
def configure
|
35
|
-
say("Configuring Hourly Database Maintenance...")
|
36
|
-
write_hourly_cron
|
37
|
-
FileUtils.chmod(0755, HOURLY_CRON)
|
38
|
-
true
|
39
|
-
end
|
40
|
-
|
41
|
-
def deactivate
|
42
|
-
say("Un-Configuring Hourly Database Maintenance...")
|
43
|
-
FileUtils.rm_f(HOURLY_CRON)
|
44
|
-
true
|
45
|
-
end
|
46
|
-
|
47
|
-
def write_hourly_cron
|
48
|
-
File.open(HOURLY_CRON, "w") do |f|
|
49
|
-
f.write("#!/bin/sh\n")
|
50
|
-
f.write("/usr/bin/hourly_reindex_metrics_tables\n")
|
51
|
-
f.write("/usr/bin/hourly_reindex_miq_queue_table\n")
|
52
|
-
f.write("/usr/bin/hourly_reindex_miq_workers_table\n")
|
53
|
-
f.write("exit 0\n")
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end # class DatabaseMaintenanceHourly
|
57
|
-
end # module ApplianceConsole
|
58
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
module ManageIQ
|
2
|
-
module ApplianceConsole
|
3
|
-
class DatabaseMaintenancePeriodic
|
4
|
-
include ManageIQ::ApplianceConsole::Logging
|
5
|
-
|
6
|
-
RUN_AS = 'root'.freeze
|
7
|
-
PERIODIC_CMD = '/usr/bin/periodic_vacuum_full_tables'.freeze
|
8
|
-
CRONTAB_FILE = '/etc/crontab'.freeze
|
9
|
-
SCHEDULE_PROMPT = 'frequency periodic database maintenance should run (hourly daily weekly monthly)'.freeze
|
10
|
-
HOUR_PROMPT = 'hour number (0..23)'.freeze
|
11
|
-
WEEK_DAY_PROMPT = 'week day number (0..6, where Sunday is 0)'.freeze
|
12
|
-
MONTH_DAY_PROMPT = 'month day number (1..31)'.freeze
|
13
|
-
|
14
|
-
attr_accessor :crontab_schedule_expression, :already_configured, :requested_deactivate, :requested_activate
|
15
|
-
|
16
|
-
def initialize
|
17
|
-
self.crontab_schedule_expression = nil
|
18
|
-
self.already_configured = File.readlines(CRONTAB_FILE).detect { |line| line =~ /#{PERIODIC_CMD}/ }.present?
|
19
|
-
self.requested_deactivate = false
|
20
|
-
self.requested_activate = false
|
21
|
-
end
|
22
|
-
|
23
|
-
def activate
|
24
|
-
return deactivate if requested_deactivate
|
25
|
-
return configure if requested_activate
|
26
|
-
false
|
27
|
-
end
|
28
|
-
|
29
|
-
def confirm
|
30
|
-
if already_configured
|
31
|
-
self.requested_deactivate = agree("Periodic Database Maintenance is already configured, Un-Configure (Y/N):")
|
32
|
-
else
|
33
|
-
self.requested_activate = agree("Configure Periodic Database Maintenance? (Y/N): ")
|
34
|
-
ask_for_schedule if requested_activate
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def ask_for_schedule
|
41
|
-
self.crontab_schedule_expression =
|
42
|
-
case ask_for_schedule_frequency(SCHEDULE_PROMPT, 'monthly')
|
43
|
-
when 'hourly'
|
44
|
-
generate_hourly_crontab_expression
|
45
|
-
when 'daily'
|
46
|
-
generate_daily_crontab_expression
|
47
|
-
when 'weekly'
|
48
|
-
generate_weekly_crontab_expression
|
49
|
-
when 'monthly'
|
50
|
-
generate_monthly_crontab_expression
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def configure
|
55
|
-
File.open(CRONTAB_FILE, "a") do |f|
|
56
|
-
f.write("#{crontab_schedule_expression} #{RUN_AS} #{PERIODIC_CMD}\n")
|
57
|
-
end
|
58
|
-
true
|
59
|
-
end
|
60
|
-
|
61
|
-
def deactivate
|
62
|
-
keep_content = File.readlines(CRONTAB_FILE).reject { |line| line =~ /#{PERIODIC_CMD}/ }
|
63
|
-
File.open(CRONTAB_FILE, "w") { |f| keep_content.each { |line| f.puts line } }
|
64
|
-
true
|
65
|
-
end
|
66
|
-
|
67
|
-
def generate_hourly_crontab_expression
|
68
|
-
"0 * * * *"
|
69
|
-
end
|
70
|
-
|
71
|
-
def generate_daily_crontab_expression
|
72
|
-
"0 #{ask_for_hour_number(HOUR_PROMPT)} * * *"
|
73
|
-
end
|
74
|
-
|
75
|
-
def generate_weekly_crontab_expression
|
76
|
-
"0 #{ask_for_hour_number(HOUR_PROMPT)} * * #{ask_for_week_day_number(WEEK_DAY_PROMPT)}"
|
77
|
-
end
|
78
|
-
|
79
|
-
def generate_monthly_crontab_expression
|
80
|
-
"0 #{ask_for_hour_number(HOUR_PROMPT)} #{ask_for_month_day_number(MONTH_DAY_PROMPT)} * *"
|
81
|
-
end
|
82
|
-
end # class DatabaseMaintenancePeriodic
|
83
|
-
end # module ApplianceConsole
|
84
|
-
end
|