foreman_maintain 0.2.10 → 0.2.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/definitions/checks/disk/performance.rb +1 -1
- data/definitions/features/downstream.rb +0 -7
- data/definitions/features/puppet.rb +3 -1
- data/definitions/features/service.rb +31 -10
- data/definitions/procedures/pulp/migrate.rb +3 -1
- data/definitions/procedures/service/status.rb +4 -1
- data/definitions/scenarios/services.rb +6 -0
- data/lib/foreman_maintain/cli/service_command.rb +5 -1
- data/lib/foreman_maintain/reporter/cli_reporter.rb +2 -0
- data/lib/foreman_maintain/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 375b11bcb879988abac384387b1ae48f9cba4685
|
4
|
+
data.tar.gz: af7cd8bd44afcea10e3483328b839550a37c6ab8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aba072d5526230ecca7596e0f180336e61c6e97276de978becbe64b07e9be990d687a0faeeddf9774c31c8f96554a32fbed3f362ccb9bbb23b533ece40594722
|
7
|
+
data.tar.gz: af43c90a8c8a750b86025a595998f9f78253640c21b7869b95662d4604f60eb7dbd871e6d6908756a4ba5c23e575cfba77453ca973cbc0fa93632ed8c820ad9b
|
@@ -76,13 +76,6 @@ class Features::Downstream < ForemanMaintain::Feature
|
|
76
76
|
sat_tools_repo_id = "rhel-#{rh_version_major}-server-satellite-tools-#{sat_version_full}-rpms"
|
77
77
|
sat_maintenance_repo_id = "rhel-#{rh_version_major}-server-satellite-maintenance-6-rpms"
|
78
78
|
|
79
|
-
# Override to use Beta repositories for sat version until GA
|
80
|
-
if sat_version.to_s == '6.4'
|
81
|
-
sat_repo_id = "rhel-server-#{rh_version_major}-satellite-6-beta-rpms"
|
82
|
-
sat_tools_repo_id = "rhel-#{rh_version_major}-server-satellite-tools-6-beta-rpms"
|
83
|
-
sat_maintenance_repo_id = "rhel-#{rh_version_major}-server-satellite-maintenance-6-beta-rpms"
|
84
|
-
end
|
85
|
-
|
86
79
|
[sat_repo_id, sat_tools_repo_id, sat_maintenance_repo_id]
|
87
80
|
end
|
88
81
|
|
@@ -15,7 +15,9 @@ class Features::Puppet < ForemanMaintain::Feature
|
|
15
15
|
'/var/lib/puppet/foreman_cache_data',
|
16
16
|
'/opt/puppetlabs/puppet/ssl/',
|
17
17
|
'/var/lib/puppet/ssl',
|
18
|
-
'/var/lib/puppet'
|
18
|
+
'/var/lib/puppet',
|
19
|
+
'/usr/share/ruby/vendor_ruby/puppet/reports/foreman.rb',
|
20
|
+
'/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/reports/foreman.rb'
|
19
21
|
]
|
20
22
|
end
|
21
23
|
end
|
@@ -45,6 +45,16 @@ class Features::Service < ForemanMaintain::Feature
|
|
45
45
|
options[:reverse] = action == 'stop'
|
46
46
|
raise 'Unsupported action detected' unless allowed_action?(action)
|
47
47
|
|
48
|
+
status, failed_services = run_action_on_services(action, options, spinner)
|
49
|
+
|
50
|
+
spinner.update("All services #{action_past_tense(action)}")
|
51
|
+
if action == 'status'
|
52
|
+
raise "Some services are not running (#{failed_services.join(', ')})" if status > 0
|
53
|
+
spinner.update('All services are running')
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def run_action_on_services(action, options, spinner)
|
48
58
|
status = 0
|
49
59
|
failed_services = []
|
50
60
|
|
@@ -52,24 +62,35 @@ class Features::Service < ForemanMaintain::Feature
|
|
52
62
|
spinner.update("#{action_noun(action)} #{service}")
|
53
63
|
item_status, output = service.send(action.to_sym)
|
54
64
|
|
65
|
+
formatted = format_status(output, item_status, options)
|
66
|
+
puts formatted unless formatted.empty?
|
67
|
+
|
55
68
|
if item_status > 0
|
56
69
|
status = item_status
|
57
70
|
failed_services << service
|
58
71
|
end
|
59
|
-
|
60
|
-
puts format_status(output)
|
61
72
|
end
|
62
|
-
|
63
|
-
spinner.update("All services #{action_past_tense(action)}")
|
64
|
-
raise "Some services are not running (#{failed_services.join(', ')})" if status > 0
|
73
|
+
[status, failed_services]
|
65
74
|
end
|
66
75
|
|
67
|
-
def format_status(output)
|
68
|
-
status =
|
69
|
-
|
76
|
+
def format_status(output, exit_code, options)
|
77
|
+
status = ''
|
78
|
+
if !options[:failing] || exit_code > 0
|
79
|
+
if options[:brief]
|
80
|
+
status += format_brief_status(exit_code)
|
81
|
+
elsif !(output.nil? || output.empty?)
|
82
|
+
status += "\n" + output
|
83
|
+
end
|
84
|
+
end
|
70
85
|
status
|
71
86
|
end
|
72
87
|
|
88
|
+
def format_brief_status(exit_code)
|
89
|
+
result = exit_code == 0 ? reporter.status_label(:success) : reporter.status_label(:fail)
|
90
|
+
padding = reporter.max_length - reporter.last_line.to_s.length - 30
|
91
|
+
"#{' ' * padding} #{result}"
|
92
|
+
end
|
93
|
+
|
73
94
|
def allowed_action?(action)
|
74
95
|
%w[start stop restart status enable disable].include?(action)
|
75
96
|
end
|
@@ -118,8 +139,8 @@ class Features::Service < ForemanMaintain::Feature
|
|
118
139
|
end
|
119
140
|
|
120
141
|
def run_katello_service(command)
|
121
|
-
puts
|
122
|
-
"Redirecting to: \n#{command}\n"
|
142
|
+
puts "Services are handled by katello-service in Satellite versions 6.2 and earlier. \n" \
|
143
|
+
"Flags --brief or --failing will be ignored if present. Redirecting to: \n#{command}\n"
|
123
144
|
puts execute(command)
|
124
145
|
end
|
125
146
|
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Procedures::Pulp
|
2
2
|
class Migrate < ForemanMaintain::Procedure
|
3
|
+
include ForemanMaintain::Concerns::SystemService
|
4
|
+
|
3
5
|
metadata do
|
4
6
|
description 'Migrate pulp db'
|
5
7
|
for_feature :pulp
|
@@ -7,7 +9,7 @@ module Procedures::Pulp
|
|
7
9
|
|
8
10
|
def run
|
9
11
|
with_spinner('Migrating pulp') do |spinner|
|
10
|
-
necessary_services = feature(:mongo).services
|
12
|
+
necessary_services = feature(:mongo).services + [system_service('qpidd', 10)]
|
11
13
|
pulp_services = %w[pulp_celerybeat pulp_workers pulp_resource_manager]
|
12
14
|
|
13
15
|
feature(:service).handle_services(spinner, 'start', :only => necessary_services)
|
@@ -5,10 +5,13 @@ module Procedures::Service
|
|
5
5
|
metadata do
|
6
6
|
description 'Get status of applicable services'
|
7
7
|
Base.common_params(self)
|
8
|
+
param :brief, 'Print only service name and status', :flag => true, :default => false
|
9
|
+
param :failing, 'List only services which are not running', :flag => true, :default => false
|
8
10
|
end
|
9
11
|
|
10
12
|
def run
|
11
|
-
|
13
|
+
format_options = { :brief => @brief, :failing => @failing }
|
14
|
+
run_service_action('status', common_options.merge(format_options))
|
12
15
|
end
|
13
16
|
end
|
14
17
|
end
|
@@ -151,6 +151,12 @@ module ForemanMaintain::Scenarios
|
|
151
151
|
|
152
152
|
context.map(:exclude,
|
153
153
|
Procedures::Service::Status => :exclude)
|
154
|
+
|
155
|
+
context.map(:brief,
|
156
|
+
Procedures::Service::Status => :brief)
|
157
|
+
|
158
|
+
context.map(:failing,
|
159
|
+
Procedures::Service::Status => :failing)
|
154
160
|
end
|
155
161
|
end
|
156
162
|
end
|
@@ -52,11 +52,15 @@ module ForemanMaintain
|
|
52
52
|
|
53
53
|
subcommand 'status', 'Get statuses of applicable services' do
|
54
54
|
service_options
|
55
|
+
option ['-b', '--brief'], :flag, 'Print only service name and status'
|
56
|
+
option ['-f', '--failing'], :flag, 'List only services which are not running'
|
55
57
|
|
56
58
|
def execute
|
57
59
|
scenario = Scenarios::ServiceStatus.new(
|
58
60
|
:only => only,
|
59
|
-
:exclude => exclude
|
61
|
+
:exclude => exclude,
|
62
|
+
:brief => brief?,
|
63
|
+
:failing => failing?
|
60
64
|
)
|
61
65
|
|
62
66
|
run_scenario(scenario)
|
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.2.
|
4
|
+
version: 0.2.11
|
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: 2018-09-
|
11
|
+
date: 2018-09-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: clamp
|