foreman_maintain 0.7.5 → 0.8.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/definitions/checks/candlepin/db_up.rb +10 -6
- data/definitions/checks/foreman/db_up.rb +10 -6
- data/definitions/checks/mongo/db_up.rb +10 -6
- data/definitions/features/foreman_tasks.rb +3 -3
- data/definitions/features/katello.rb +8 -3
- data/definitions/features/mongo.rb +10 -0
- data/definitions/features/pulp2.rb +1 -1
- data/definitions/features/service.rb +39 -19
- data/definitions/procedures/content/migration_reset.rb +12 -0
- data/definitions/procedures/content/switchover.rb +3 -0
- data/definitions/procedures/pulp/remove.rb +87 -0
- data/definitions/procedures/service/base.rb +2 -3
- data/definitions/procedures/service/list.rb +1 -0
- data/definitions/scenarios/content.rb +51 -21
- data/definitions/scenarios/restore.rb +1 -1
- data/lib/foreman_maintain/cli/content_command.rb +12 -0
- data/lib/foreman_maintain/concerns/base_database.rb +11 -0
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed8b16b2a22acb7bf2e2768976f2df46eb6a1b51b883904cbee0bb180869c5a4
|
4
|
+
data.tar.gz: 46473f96dba47ffc94f08fbb15fa031073852cdc234c8c701d5568a7727d269d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76da2fe52b25ac48af18295caaa92dad1e2cb106a8aaded53adc02804da1ef2c021a6d336e10e4abea87d6aed1f9950a9b994cc6dba075b8b116a31ea9c6b706
|
7
|
+
data.tar.gz: d25955e6f87bfb863d050935bf4ed253c2afa55e1552ec17edcc76500c6d563d7fe318b84d68877c942c63facdd3c93d973591df5e93fedd9fd445a4ff4c845a
|
@@ -9,15 +9,19 @@ module Checks
|
|
9
9
|
|
10
10
|
def run
|
11
11
|
status = false
|
12
|
-
|
13
|
-
|
12
|
+
if feature(:candlepin_database).psql_cmd_available?
|
13
|
+
with_spinner('Checking connection to the Candlepin DB') do
|
14
|
+
status = feature(:candlepin_database).ping
|
15
|
+
end
|
16
|
+
assert(status, 'Candlepin DB is not responding. ' \
|
17
|
+
'It needs to be up and running to perform the following steps',
|
18
|
+
:next_steps => start_pgsql)
|
19
|
+
else
|
20
|
+
feature(:candlepin_database).raise_psql_missing_error
|
14
21
|
end
|
15
|
-
assert(status, 'Candlepin DB is not responding. ' \
|
16
|
-
'It needs to be up and running to perform the following steps',
|
17
|
-
:next_steps => next_steps)
|
18
22
|
end
|
19
23
|
|
20
|
-
def
|
24
|
+
def start_pgsql
|
21
25
|
if feature(:candlepin_database).local?
|
22
26
|
[Procedures::Service::Start.new(:only => 'postgresql')]
|
23
27
|
else
|
@@ -9,15 +9,19 @@ module Checks
|
|
9
9
|
|
10
10
|
def run
|
11
11
|
status = false
|
12
|
-
|
13
|
-
|
12
|
+
if feature(:foreman_database).psql_cmd_available?
|
13
|
+
with_spinner('Checking connection to the Foreman DB') do
|
14
|
+
status = feature(:foreman_database).ping
|
15
|
+
end
|
16
|
+
assert(status, 'Foreman DB is not responding. ' \
|
17
|
+
'It needs to be up and running to perform the following steps',
|
18
|
+
:next_steps => start_pgsql)
|
19
|
+
else
|
20
|
+
feature(:foreman_database).raise_psql_missing_error
|
14
21
|
end
|
15
|
-
assert(status, 'Foreman DB is not responding. ' \
|
16
|
-
'It needs to be up and running to perform the following steps',
|
17
|
-
:next_steps => next_steps)
|
18
22
|
end
|
19
23
|
|
20
|
-
def
|
24
|
+
def start_pgsql
|
21
25
|
if feature(:foreman_database).local?
|
22
26
|
[Procedures::Service::Start.new(:only => 'postgresql')]
|
23
27
|
else
|
@@ -9,15 +9,19 @@ module Checks
|
|
9
9
|
|
10
10
|
def run
|
11
11
|
status = false
|
12
|
-
|
13
|
-
|
12
|
+
if feature(:mongo).mongo_cmd_available?
|
13
|
+
with_spinner('Checking connection to the Mongo DB') do
|
14
|
+
status = feature(:mongo).ping
|
15
|
+
end
|
16
|
+
assert(status, 'Mongo DB is not responding. ' \
|
17
|
+
'It needs to be up and running to perform the following steps.',
|
18
|
+
:next_steps => start_mongodb)
|
19
|
+
else
|
20
|
+
feature(:mongo).raise_mongo_client_missing_error
|
14
21
|
end
|
15
|
-
assert(status, 'Mongo DB is not responding. ' \
|
16
|
-
'It needs to be up and running to perform the following steps.',
|
17
|
-
:next_steps => next_steps)
|
18
22
|
end
|
19
23
|
|
20
|
-
def
|
24
|
+
def start_mongodb
|
21
25
|
if feature(:mongo).local?
|
22
26
|
[Procedures::Service::Start.new(:only => feature(:mongo).services)]
|
23
27
|
else
|
@@ -97,10 +97,10 @@ class Features::ForemanTasks < ForemanMaintain::Feature
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def resume_task_using_hammer
|
100
|
-
if
|
101
|
-
feature(:hammer).run('task resume --search ""')
|
100
|
+
if feature(:satellite) && feature(:satellite).current_minor_version == '6.8'
|
101
|
+
feature(:hammer).run('task resume --search "" --fields="Total tasks resumed"')
|
102
102
|
else
|
103
|
-
feature(:hammer).run('task resume')
|
103
|
+
feature(:hammer).run('task resume --fields="Total tasks resumed"')
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -16,9 +16,14 @@ class Features::Katello < ForemanMaintain::Feature
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def services
|
19
|
-
|
20
|
-
|
21
|
-
|
19
|
+
if feature(:pulp2)
|
20
|
+
[]
|
21
|
+
else
|
22
|
+
[
|
23
|
+
system_service('qpidd', 10),
|
24
|
+
system_service('qdrouterd', 10)
|
25
|
+
]
|
26
|
+
end
|
22
27
|
end
|
23
28
|
|
24
29
|
# rubocop:disable Metrics/MethodLength
|
@@ -140,6 +140,16 @@ class Features::Mongo < ForemanMaintain::Feature
|
|
140
140
|
end
|
141
141
|
end
|
142
142
|
|
143
|
+
def mongo_cmd_available?
|
144
|
+
exit_status, _output = execute_with_status('which mongo')
|
145
|
+
exit_status == 0
|
146
|
+
end
|
147
|
+
|
148
|
+
def raise_mongo_client_missing_error
|
149
|
+
raise ForemanMaintain::Error::Fail, 'The mongo command not found.'\
|
150
|
+
' Make sure system has mongo utility installed.'
|
151
|
+
end
|
152
|
+
|
143
153
|
private
|
144
154
|
|
145
155
|
def load_mongo_core_default(version)
|
@@ -8,7 +8,6 @@ class Features::Service < ForemanMaintain::Feature
|
|
8
8
|
# { :only => ["httpd"] }
|
9
9
|
# { :exclude => ["pulp-workers", "tomcat"] }
|
10
10
|
# { :include => ["crond"] }
|
11
|
-
|
12
11
|
if feature(:instance).downstream && feature(:instance).downstream.less_than_version?('6.3')
|
13
12
|
use_katello_service(action, options)
|
14
13
|
else
|
@@ -26,12 +25,14 @@ class Features::Service < ForemanMaintain::Feature
|
|
26
25
|
select(&:exist?)
|
27
26
|
end
|
28
27
|
|
29
|
-
def filtered_services(options)
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
def filtered_services(options, action = '')
|
29
|
+
services = include_unregistered_services(existing_services, options[:include])
|
30
|
+
services = filter_services(services, options, action)
|
31
|
+
|
32
|
+
raise 'No services found matching your parameters' unless services.any?
|
33
|
+
return services unless options[:reverse]
|
33
34
|
|
34
|
-
|
35
|
+
Hash[services.sort_by { |k, _| k.to_i }.reverse]
|
35
36
|
end
|
36
37
|
|
37
38
|
def action_noun(action)
|
@@ -61,22 +62,31 @@ class Features::Service < ForemanMaintain::Feature
|
|
61
62
|
def run_action_on_services(action, options, spinner)
|
62
63
|
status = 0
|
63
64
|
failed_services = []
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
65
|
+
filtered_services(options, action).each_value do |group|
|
66
|
+
fork_threads_for_services(action, group, spinner).each do |service, status_and_output|
|
67
|
+
spinner.update("#{action_noun(action)} #{service}") if action == 'status'
|
68
|
+
item_status, output = status_and_output
|
69
|
+
formatted = format_status(output, item_status, options)
|
70
|
+
puts formatted unless formatted.empty?
|
71
|
+
|
72
|
+
if item_status > 0
|
73
|
+
status = item_status
|
74
|
+
failed_services << service
|
75
|
+
end
|
75
76
|
end
|
76
77
|
end
|
77
78
|
[status, failed_services]
|
78
79
|
end
|
79
80
|
|
81
|
+
def fork_threads_for_services(action, services, spinner)
|
82
|
+
services_and_statuses = []
|
83
|
+
services.each do |service|
|
84
|
+
spinner.update("#{action_noun(action)} #{service}") if action != 'status'
|
85
|
+
services_and_statuses << [service, Thread.new { service.send(action.to_sym) }]
|
86
|
+
end
|
87
|
+
services_and_statuses.map! { |service, status| [service, status.value] }
|
88
|
+
end
|
89
|
+
|
80
90
|
def format_status(output, exit_code, options)
|
81
91
|
status = ''
|
82
92
|
if !options[:failing] || exit_code > 0
|
@@ -106,7 +116,8 @@ class Features::Service < ForemanMaintain::Feature
|
|
106
116
|
service_list + socket_list
|
107
117
|
end
|
108
118
|
|
109
|
-
|
119
|
+
# rubocop:disable Metrics/AbcSize
|
120
|
+
def filter_services(service_list, options, action)
|
110
121
|
if options[:only] && options[:only].any?
|
111
122
|
service_list = service_list.select do |service|
|
112
123
|
options[:only].any? { |opt| service.matches?(opt) }
|
@@ -119,7 +130,16 @@ class Features::Service < ForemanMaintain::Feature
|
|
119
130
|
end
|
120
131
|
|
121
132
|
service_list = extend_service_list_with_sockets(service_list, options)
|
122
|
-
service_list
|
133
|
+
service_list = filter_disabled_services!(action, service_list)
|
134
|
+
service_list.group_by(&:priority).to_h
|
135
|
+
end
|
136
|
+
# rubocop:enable Metrics/AbcSize
|
137
|
+
|
138
|
+
def filter_disabled_services!(action, service_list)
|
139
|
+
if %w[start stop restart status].include?(action)
|
140
|
+
service_list.select!(&:enabled?)
|
141
|
+
end
|
142
|
+
service_list
|
123
143
|
end
|
124
144
|
|
125
145
|
def include_unregistered_services(service_list, services_filter)
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Procedures::Content
|
2
|
+
class MigrationReset < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Reset the Pulp 2 to Pulp 3 migration data (pre-switchover)'
|
5
|
+
for_feature :pulpcore
|
6
|
+
end
|
7
|
+
|
8
|
+
def run
|
9
|
+
puts execute!('foreman-rake katello:pulp3_migration_reset')
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -19,8 +19,11 @@ module Procedures::Content
|
|
19
19
|
puts execute!('foreman-rake katello:pulp3_content_switchover')
|
20
20
|
puts 'Re-running the installer to switch specified content over to pulp3'
|
21
21
|
args = ['--foreman-proxy-content-proxy-pulp-isos-to-pulpcore=true',
|
22
|
+
'--foreman-proxy-content-proxy-pulp-yum-to-pulpcore=true',
|
23
|
+
'--foreman-proxy-content-proxy-pulp-deb-to-pulpcore=true',
|
22
24
|
'--katello-use-pulp-2-for-file=false',
|
23
25
|
'--katello-use-pulp-2-for-docker=false',
|
26
|
+
'--katello-use-pulp-2-for-deb=false',
|
24
27
|
'--katello-use-pulp-2-for-yum=false']
|
25
28
|
feature(:installer).run(args.join(' '))
|
26
29
|
end
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Procedures::Pulp
|
2
|
+
class Remove < ForemanMaintain::Procedure
|
3
|
+
metadata do
|
4
|
+
description 'Remove pulp2'
|
5
|
+
|
6
|
+
confine do
|
7
|
+
check_min_version('katello-common', '4.0')
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def sys
|
12
|
+
ForemanMaintain::Utils::SystemHelpers.new
|
13
|
+
end
|
14
|
+
|
15
|
+
def pulp_data_dirs
|
16
|
+
[
|
17
|
+
'/var/lib/pulp/published',
|
18
|
+
'/var/lib/pulp/content',
|
19
|
+
'/var/lib/pulp/importers',
|
20
|
+
'/var/lib/pulp/uploads',
|
21
|
+
'/var/lib/mongodb/'
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
def pulp_packages
|
26
|
+
[
|
27
|
+
'pulp-server', 'python-pulp-streamer', 'pulp-puppet-plugins',
|
28
|
+
'python-pulp-rpm-common', 'python-pulp-common',
|
29
|
+
'pulp-selinux', 'python-pulp-oid_validation',
|
30
|
+
'python-pulp-puppet-common', 'python-pulp-repoauth',
|
31
|
+
'pulp-rpm-plugins', 'python-blinker', 'python-celery',
|
32
|
+
'python-django', 'python-isodate', 'python-ldap',
|
33
|
+
'python-mongoengine', 'python-nectar', 'python-oauth2',
|
34
|
+
'python-pymongo'
|
35
|
+
]
|
36
|
+
end
|
37
|
+
|
38
|
+
def data_dir_removal_cmds
|
39
|
+
pulp_data_dirs.collect { |dir| "rm -rf #{dir}" }
|
40
|
+
end
|
41
|
+
|
42
|
+
def ask_to_proceed(rm_cmds)
|
43
|
+
question = "\nWARNING: All pulp2 packages will be removed with the following commands:\n" \
|
44
|
+
"\n# yum remove #{pulp_packages.join(' ')}" \
|
45
|
+
"\n# yum remove rh-mongodb34-*" \
|
46
|
+
"\n\nAll pulp2 data will be removed.\n"
|
47
|
+
question += rm_cmds.collect { |cmd| "\n# #{cmd}" }.join
|
48
|
+
question += "\n\nDo you want to proceed?"
|
49
|
+
answer = ask_decision(question, actions_msg: 'y(yes), q(quit)')
|
50
|
+
abort! if answer != :yes
|
51
|
+
end
|
52
|
+
|
53
|
+
def run
|
54
|
+
rm_cmds = data_dir_removal_cmds
|
55
|
+
ask_to_proceed(rm_cmds)
|
56
|
+
|
57
|
+
remove_pulp
|
58
|
+
|
59
|
+
remove_mongo
|
60
|
+
|
61
|
+
delete_pulp_data(rm_cmds)
|
62
|
+
end
|
63
|
+
|
64
|
+
def remove_pulp
|
65
|
+
with_spinner('Removing pulp2 packages') do
|
66
|
+
packages_action(:remove, pulp_packages, :assumeyes => true)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def remove_mongo
|
71
|
+
with_spinner('Removing mongo packages') do
|
72
|
+
packages_action(:remove, ['rh-mongodb34-*'], :assumeyes => true)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def delete_pulp_data(rm_cmds)
|
77
|
+
with_spinner('Deleting pulp2 data directories') do |spinner|
|
78
|
+
rm_cmds.each do |cmd|
|
79
|
+
if File.directory?(cmd.split[2])
|
80
|
+
execute!(cmd)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
spinner.update('Done deleting pulp2 data directories')
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
@@ -16,9 +16,8 @@ module Procedures
|
|
16
16
|
def run_service_action(action, options)
|
17
17
|
action_noun = feature(:service).action_noun(action).capitalize
|
18
18
|
puts "\n#{action_noun} the following service(s):"
|
19
|
-
services = feature(:service).filtered_services(options)
|
19
|
+
services = feature(:service).filtered_services(options, action)
|
20
20
|
print_services(services)
|
21
|
-
|
22
21
|
with_spinner('') do |spinner|
|
23
22
|
feature(:service).handle_services(spinner, action, options)
|
24
23
|
end
|
@@ -31,7 +30,7 @@ module Procedures
|
|
31
30
|
private
|
32
31
|
|
33
32
|
def print_services(services)
|
34
|
-
puts services.
|
33
|
+
puts services.values.flatten(1).join(', ')
|
35
34
|
end
|
36
35
|
end
|
37
36
|
end
|
@@ -1,6 +1,23 @@
|
|
1
1
|
module ForemanMaintain::Scenarios
|
2
2
|
module Content
|
3
|
-
class
|
3
|
+
class ContentBase < ForemanMaintain::Scenario
|
4
|
+
def enable_and_start_services
|
5
|
+
add_step(Procedures::Service::Start)
|
6
|
+
add_step(Procedures::Service::Enable.
|
7
|
+
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
8
|
+
add_step(Procedures::Service::Start.
|
9
|
+
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
10
|
+
end
|
11
|
+
|
12
|
+
def disable_and_stop_services
|
13
|
+
add_step(Procedures::Service::Stop.
|
14
|
+
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
15
|
+
add_step(Procedures::Service::Disable.
|
16
|
+
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class Prepare < ContentBase
|
4
21
|
metadata do
|
5
22
|
label :content_prepare
|
6
23
|
description 'Prepare content for Pulp 3'
|
@@ -16,26 +33,9 @@ module ForemanMaintain::Scenarios
|
|
16
33
|
add_step(Procedures::Content::Prepare)
|
17
34
|
end
|
18
35
|
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def enable_and_start_services
|
23
|
-
add_step(Procedures::Service::Start)
|
24
|
-
add_step(Procedures::Service::Enable.
|
25
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
26
|
-
add_step(Procedures::Service::Start.
|
27
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
28
|
-
end
|
29
|
-
|
30
|
-
def disable_and_stop_services
|
31
|
-
add_step(Procedures::Service::Stop.
|
32
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
33
|
-
add_step(Procedures::Service::Disable.
|
34
|
-
new(:only => Features::Pulpcore.pulpcore_migration_services))
|
35
|
-
end
|
36
36
|
end
|
37
37
|
|
38
|
-
class Switchover <
|
38
|
+
class Switchover < ContentBase
|
39
39
|
metadata do
|
40
40
|
label :content_switchover
|
41
41
|
description 'Switch support for certain content from Pulp 2 to Pulp 3'
|
@@ -51,7 +51,7 @@ module ForemanMaintain::Scenarios
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
|
-
class PrepareAbort <
|
54
|
+
class PrepareAbort < ContentBase
|
55
55
|
metadata do
|
56
56
|
label :content_prepare_abort
|
57
57
|
description 'Abort all running Pulp 2 to Pulp 3 migration tasks'
|
@@ -65,7 +65,7 @@ module ForemanMaintain::Scenarios
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
class MigrationStats <
|
68
|
+
class MigrationStats < ContentBase
|
69
69
|
metadata do
|
70
70
|
label :content_migration_stats
|
71
71
|
description 'Retrieve Pulp 2 to Pulp 3 migration statistics'
|
@@ -78,5 +78,35 @@ module ForemanMaintain::Scenarios
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
81
|
+
|
82
|
+
class MigrationReset < ContentBase
|
83
|
+
metadata do
|
84
|
+
label :content_migration_reset
|
85
|
+
description 'Reset the Pulp 2 to Pulp 3 migration data (pre-switchover)'
|
86
|
+
manual_detection
|
87
|
+
end
|
88
|
+
|
89
|
+
def compose
|
90
|
+
if feature(:satellite) && feature(:satellite).at_least_version?('6.9')
|
91
|
+
enable_and_start_services
|
92
|
+
add_step(Procedures::Content::MigrationReset)
|
93
|
+
disable_and_stop_services
|
94
|
+
elsif !feature(:satellite)
|
95
|
+
add_step(Procedures::Content::MigrationReset)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
class RemovePulp2 < ContentBase
|
101
|
+
metadata do
|
102
|
+
label :content_remove_pulp2
|
103
|
+
description 'Remove Pulp2 and mongodb packages and data'
|
104
|
+
manual_detection
|
105
|
+
end
|
106
|
+
|
107
|
+
def compose
|
108
|
+
add_step_with_context(Procedures::Pulp::Remove)
|
109
|
+
end
|
110
|
+
end
|
81
111
|
end
|
82
112
|
end
|
@@ -27,6 +27,18 @@ module ForemanMaintain
|
|
27
27
|
run_scenarios_and_exit(Scenarios::Content::MigrationStats.new)
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
subcommand 'migration-reset', 'Reset the Pulp 2 to Pulp 3 migration data (pre-switchover)' do
|
32
|
+
def execute
|
33
|
+
run_scenarios_and_exit(Scenarios::Content::MigrationReset.new)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
subcommand 'remove-pulp2', 'Remove pulp2 and mongodb packages and data' do
|
38
|
+
def execute
|
39
|
+
run_scenarios_and_exit(Scenarios::Content::RemovePulp2.new)
|
40
|
+
end
|
41
|
+
end
|
30
42
|
end
|
31
43
|
end
|
32
44
|
end
|
@@ -119,6 +119,7 @@ module ForemanMaintain
|
|
119
119
|
SQL
|
120
120
|
result = query(sql)
|
121
121
|
return false if result.nil? || (result && result.empty?)
|
122
|
+
|
122
123
|
result.first['exists'].eql?('t')
|
123
124
|
end
|
124
125
|
|
@@ -161,6 +162,16 @@ module ForemanMaintain
|
|
161
162
|
end
|
162
163
|
end
|
163
164
|
|
165
|
+
def psql_cmd_available?
|
166
|
+
exit_status, _output = execute_with_status('which psql')
|
167
|
+
exit_status == 0
|
168
|
+
end
|
169
|
+
|
170
|
+
def raise_psql_missing_error
|
171
|
+
raise Error::Fail, 'The psql command not found.'\
|
172
|
+
' Make sure system has psql utility installed.'
|
173
|
+
end
|
174
|
+
|
164
175
|
private
|
165
176
|
|
166
177
|
def base_command(config, command = 'psql')
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_maintain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ivan Nečas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|
@@ -222,6 +222,7 @@ files:
|
|
222
222
|
- definitions/procedures/backup/snapshot/mount_pulpcore_db.rb
|
223
223
|
- definitions/procedures/backup/snapshot/prepare_mount.rb
|
224
224
|
- definitions/procedures/candlepin/delete_orphaned_records_from_env_content.rb
|
225
|
+
- definitions/procedures/content/migration_reset.rb
|
225
226
|
- definitions/procedures/content/migration_stats.rb
|
226
227
|
- definitions/procedures/content/prepare.rb
|
227
228
|
- definitions/procedures/content/prepare_abort.rb
|
@@ -259,6 +260,7 @@ files:
|
|
259
260
|
- definitions/procedures/passenger_recycler.rb
|
260
261
|
- definitions/procedures/prep_6_10_upgrade.rb
|
261
262
|
- definitions/procedures/pulp/migrate.rb
|
263
|
+
- definitions/procedures/pulp/remove.rb
|
262
264
|
- definitions/procedures/pulpcore/migrate.rb
|
263
265
|
- definitions/procedures/puppet/delete_empty_ca_cert_request_files.rb
|
264
266
|
- definitions/procedures/remote_execution/remove_existing_settingsd.rb
|
@@ -416,7 +418,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
416
418
|
- !ruby/object:Gem::Version
|
417
419
|
version: '0'
|
418
420
|
requirements: []
|
419
|
-
rubygems_version: 3.0.
|
421
|
+
rubygems_version: 3.0.9
|
420
422
|
signing_key:
|
421
423
|
specification_version: 4
|
422
424
|
summary: Foreman maintenance tool belt
|