manageiq-smartstate 0.2.13 → 0.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/manageiq/smartstate/version.rb +1 -1
- data/lib/metadata/linux/LinuxUtils.rb +91 -12
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b2a69c35013227fbededdcfef2bed9796a0c53f
|
4
|
+
data.tar.gz: fe7ba8f2036accdce13806943d28111f242e2c7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 16acbf991c60b44a496b5cb2c58dec958aeb58153d3b0c52d77f6bad3c2881e8406b15873a45653b24cbd38865ffa5dbfe983bd543a3f2526c9a72fb242f78e8
|
7
|
+
data.tar.gz: 32c7792c1a7d8cbe76ec19023d3be90760782de2e804aabe485c1fd5f8e6d21e8923d881316316b3485c7c843e6f04c083d5a10f779bb5001d814d3599b15e73
|
@@ -117,7 +117,7 @@ module MiqLinux
|
|
117
117
|
end
|
118
118
|
|
119
119
|
def self.parse_systemctl_list(lines)
|
120
|
-
return [] if lines.
|
120
|
+
return [] if lines.blank?
|
121
121
|
|
122
122
|
lines.each_line.map do |line|
|
123
123
|
line = line.chomp
|
@@ -141,6 +141,27 @@ module MiqLinux
|
|
141
141
|
end.compact
|
142
142
|
end
|
143
143
|
|
144
|
+
def self.parse_docker_ps_list(lines)
|
145
|
+
return [] if lines.blank?
|
146
|
+
|
147
|
+
lines.each_line.map do |line|
|
148
|
+
line = line.chomp
|
149
|
+
parts = line.split(/^(\S+)\s/)
|
150
|
+
|
151
|
+
name, = parts[1]
|
152
|
+
|
153
|
+
{:name => name,
|
154
|
+
:systemd_load => 'container',
|
155
|
+
:systemd_active => parts[2]&.strip&.start_with?('Up') ? 'active' : 'failed',
|
156
|
+
:systemd_sub => parts[2]&.strip&.start_with?('Up') ? 'running' : 'failed',
|
157
|
+
:typename => 'docker_container',
|
158
|
+
:description => parts[1] + ' ' + parts[2].strip,
|
159
|
+
:enable_run_level => nil,
|
160
|
+
:disable_run_level => nil,
|
161
|
+
:running => parts[2]&.strip&.start_with?('Up')}
|
162
|
+
end.compact
|
163
|
+
end
|
164
|
+
|
144
165
|
def self.collect_interface(interfaces, interface)
|
145
166
|
mac_addr = interface[:mac_address]
|
146
167
|
return if mac_addr.blank?
|
@@ -177,21 +198,79 @@ module MiqLinux
|
|
177
198
|
end
|
178
199
|
|
179
200
|
def self.parse_openstack_status(lines)
|
180
|
-
lines.to_s.split("\n").reject{|t| t.include?
|
201
|
+
lines = lines.to_s.split("\n").reject { |t| t.include?("=") }.group_by { |t| t.gsub(/openstack\-([a-z]+).*/i, '\1') }
|
202
|
+
lines.map do |title, services|
|
203
|
+
services = services.map { |service_line| service_line.split(/[:\(\)]/).map(&:strip) } # split service line by :, ( and ) and strip white space from results
|
204
|
+
|
205
|
+
services = services.map do |service|
|
206
|
+
{
|
207
|
+
'name' => service.first,
|
208
|
+
'active' => service[1] == 'active',
|
209
|
+
'enabled' => service[2] !~ /disabled/
|
210
|
+
}
|
211
|
+
end
|
212
|
+
|
181
213
|
{
|
182
214
|
'name' => title.capitalize,
|
183
|
-
'services' => services
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
215
|
+
'services' => services
|
216
|
+
}
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
def self.parse_openstack_container_status(lines)
|
221
|
+
containers = lines.to_s.split("\n").group_by do |t|
|
222
|
+
if t.include?('_')
|
223
|
+
t.split("_")[0]
|
224
|
+
elsif t.start_with?('openstack')
|
225
|
+
t.split("-")[1]
|
226
|
+
elsif t.include?('-')
|
227
|
+
t.split("-")[0]
|
228
|
+
else
|
229
|
+
t.split(" ")[0]
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
containers.map do |title, services|
|
234
|
+
services = services.map { |service_line| service_line.split(/^(\S+)\s/) } # split service line by first space and strip white space from results
|
235
|
+
|
236
|
+
services = services.map do |service|
|
237
|
+
{
|
238
|
+
'name' => service[1],
|
239
|
+
'active' => service[2].strip.start_with?('Up'),
|
240
|
+
'enabled' => true
|
241
|
+
}
|
242
|
+
end
|
243
|
+
|
244
|
+
{
|
245
|
+
'name' => title.capitalize,
|
246
|
+
'services' => services
|
193
247
|
}
|
194
248
|
end
|
195
249
|
end
|
250
|
+
|
251
|
+
def self.merge_openstack_services(systemctl_services, containerized_services)
|
252
|
+
# Merge outputs 2 arrays with systemctl and containerized services, example:
|
253
|
+
# systemctl_services = [{"name"=>"Swift", "services"=> [{"name"=>"openstack-swift-proxy", "active"=>true, "enabled"=>true}]
|
254
|
+
# containerized_services = [{"name"=>"Swift", "services"=> [{"name"=>"swift_container_auditor", "active"=>true, "enabled"=>true}]
|
255
|
+
# result is [{"name"=>"Swift", "services"=> [{"name"=>"openstack-swift-proxy", "active"=>true, "enabled"=>true},
|
256
|
+
# {"name"=>"swift_container_auditor", "active"=>true, "enabled"=>true}]
|
257
|
+
|
258
|
+
all_services = systemctl_services + containerized_services
|
259
|
+
|
260
|
+
service_names = all_services.map { |service| service['name'] }.uniq
|
261
|
+
|
262
|
+
service_names.each do |name|
|
263
|
+
merged_service = { "name" => name, "services" => [] }
|
264
|
+
common_services = all_services.select { |service| service['name'] == name }
|
265
|
+
|
266
|
+
common_services.each do |common_service|
|
267
|
+
merged_service["services"].concat(common_service["services"])
|
268
|
+
all_services.delete(common_service)
|
269
|
+
end
|
270
|
+
all_services << merged_service
|
271
|
+
end
|
272
|
+
|
273
|
+
all_services
|
274
|
+
end
|
196
275
|
end
|
197
276
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manageiq-smartstate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Developers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: azure-armrest
|
@@ -584,7 +584,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
584
584
|
version: '0'
|
585
585
|
requirements: []
|
586
586
|
rubyforge_project:
|
587
|
-
rubygems_version: 2.6.
|
587
|
+
rubygems_version: 2.6.12
|
588
588
|
signing_key:
|
589
589
|
specification_version: 4
|
590
590
|
summary: ManageIQ SmartState Analysis
|