machinery-tool 1.14.2 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.git_revision +1 -1
  3. data/NEWS +14 -0
  4. data/html/assets/compare/machinery.js +20 -13
  5. data/html/assets/file_loader.gif +0 -0
  6. data/html/assets/machinery-base.css +21 -12
  7. data/html/assets/machinery-base.js +19 -0
  8. data/html/assets/machinery.css +35 -11
  9. data/html/assets/show/machinery.js +24 -7
  10. data/html/comparison.html.haml +13 -36
  11. data/html/index.html.haml +32 -47
  12. data/html/partials/changed_managed_files.html.haml +5 -5
  13. data/html/partials/compare/changed_managed_file_list.html.haml +1 -1
  14. data/html/partials/compare/changed_managed_files.html.haml +41 -47
  15. data/html/partials/compare/changes.html.haml +8 -0
  16. data/html/partials/compare/config_file_list.html.haml +5 -5
  17. data/html/partials/compare/config_files.html.haml +38 -44
  18. data/html/partials/compare/group_list.html.haml +3 -3
  19. data/html/partials/compare/groups.html.haml +34 -42
  20. data/html/partials/compare/os.html.haml +21 -23
  21. data/html/partials/compare/package_list.html.haml +2 -2
  22. data/html/partials/compare/packages.html.haml +40 -56
  23. data/html/partials/compare/pattern_list.html.haml +2 -2
  24. data/html/partials/compare/patterns.html.haml +40 -42
  25. data/html/partials/compare/repositories.html.haml +40 -41
  26. data/html/partials/compare/service_list.html.haml +1 -1
  27. data/html/partials/compare/services.html.haml +44 -36
  28. data/html/partials/compare/summary.html.haml +17 -0
  29. data/html/partials/compare/unmanaged_file_list.html.haml +4 -3
  30. data/html/partials/compare/unmanaged_files.html.haml +44 -38
  31. data/html/partials/compare/user_list.html.haml +2 -2
  32. data/html/partials/compare/users.html.haml +40 -43
  33. data/html/partials/config_files.html.haml +8 -8
  34. data/html/partials/os.html.haml +8 -5
  35. data/html/partials/packages.html.haml +4 -4
  36. data/html/partials/patterns.html.haml +2 -2
  37. data/html/partials/repositories.html.haml +5 -5
  38. data/html/partials/scope_header.html.haml +4 -6
  39. data/html/partials/services.html.haml +1 -1
  40. data/html/partials/unmanaged_files.html.haml +1 -1
  41. data/html/partials/users.html.haml +4 -4
  42. data/lib/array.rb +4 -0
  43. data/lib/cli.rb +12 -4
  44. data/lib/file_scope.rb +9 -3
  45. data/lib/html.rb +1 -0
  46. data/lib/machinery.rb +1 -0
  47. data/lib/scope.rb +16 -0
  48. data/lib/server.rb +61 -23
  49. data/lib/system_description.rb +0 -8
  50. data/lib/try.rb +28 -0
  51. data/lib/version.rb +1 -1
  52. data/machinery-helper/version.go +1 -1
  53. data/man/generated/machinery.1.gz +0 -0
  54. data/man/generated/machinery.1.html +54 -22
  55. data/plugins/changed_managed_files/{changed_managed_files.md → changed_managed_files.yml} +4 -0
  56. data/plugins/changed_managed_files/changed_managed_files_model.rb +14 -0
  57. data/plugins/changed_managed_files/changed_managed_files_renderer.rb +17 -0
  58. data/plugins/config_files/{config_files.md → config_files.yml} +4 -0
  59. data/plugins/config_files/config_files_model.rb +14 -0
  60. data/plugins/config_files/config_files_renderer.rb +17 -0
  61. data/plugins/groups/{groups.md → groups.yml} +4 -0
  62. data/plugins/groups/groups_model.rb +14 -0
  63. data/plugins/groups/groups_renderer.rb +17 -0
  64. data/plugins/os/{os.md → os.yml} +4 -0
  65. data/plugins/packages/{packages.md → packages.yml} +4 -0
  66. data/plugins/packages/packages_model.rb +1 -12
  67. data/plugins/patterns/{patterns.md → patterns.yml} +4 -0
  68. data/plugins/patterns/patterns_model.rb +14 -0
  69. data/plugins/patterns/patterns_renderer.rb +21 -0
  70. data/plugins/repositories/{repositories.md → repositories.yml} +4 -0
  71. data/plugins/repositories/repositories_model.rb +14 -0
  72. data/plugins/repositories/repositories_renderer.rb +17 -0
  73. data/plugins/services/{services.md → services.yml} +4 -0
  74. data/plugins/services/services_model.rb +21 -11
  75. data/plugins/services/services_renderer.rb +17 -0
  76. data/plugins/unmanaged_files/{unmanaged_files.md → unmanaged_files.yml} +4 -0
  77. data/plugins/unmanaged_files/unmanaged_files_model.rb +2 -1
  78. data/plugins/unmanaged_files/unmanaged_files_renderer.rb +17 -0
  79. data/plugins/users/{users.md → users.yml} +4 -0
  80. data/plugins/users/users_model.rb +38 -0
  81. data/plugins/users/users_renderer.rb +17 -0
  82. metadata +17 -32
  83. data/html/assets/logo-changed-managed-files-small.png +0 -0
  84. data/html/assets/logo-changed-managed-files.png +0 -0
  85. data/html/assets/logo-config-files-small.png +0 -0
  86. data/html/assets/logo-config-files.png +0 -0
  87. data/html/assets/logo-groups-small.png +0 -0
  88. data/html/assets/logo-groups.png +0 -0
  89. data/html/assets/logo-os-small.png +0 -0
  90. data/html/assets/logo-os.png +0 -0
  91. data/html/assets/logo-packages-small.png +0 -0
  92. data/html/assets/logo-packages.png +0 -0
  93. data/html/assets/logo-patterns-small.png +0 -0
  94. data/html/assets/logo-patterns.png +0 -0
  95. data/html/assets/logo-repositories-small.png +0 -0
  96. data/html/assets/logo-repositories.png +0 -0
  97. data/html/assets/logo-services-small.png +0 -0
  98. data/html/assets/logo-services.png +0 -0
  99. data/html/assets/logo-unmanaged-files-small.png +0 -0
  100. data/html/assets/logo-unmanaged-files.png +0 -0
  101. data/html/assets/logo-users-small.png +0 -0
  102. data/html/assets/logo-users.png +0 -0
@@ -291,14 +291,6 @@ class SystemDescription < Machinery::Object
291
291
  return parse_variable_assignment(file.content, key) if file
292
292
  end
293
293
  end
294
- # if scope_extracted?("config_files")
295
- # file = self["config_files"].files.find { |f| f.name == path }
296
- # return parse_variable_assignment(file.content, key) if file
297
- # end
298
- # if scope_extracted?("unmanaged_files")
299
- # file = self["unmanaged_files"].files.find { |f| f.name == path }
300
- # return parse_variable_assignment(file.content, key) if file
301
- # end
302
294
  end
303
295
 
304
296
  private
data/lib/try.rb ADDED
@@ -0,0 +1,28 @@
1
+ # Copyright (c) 2013-2015 SUSE LLC
2
+ #
3
+ # This program is free software; you can redistribute it and/or
4
+ # modify it under the terms of version 3 of the GNU General Public License as
5
+ # published by the Free Software Foundation.
6
+ #
7
+ # This program is distributed in the hope that it will be useful,
8
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
9
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
+ # GNU General Public License for more details.
11
+ #
12
+ # You should have received a copy of the GNU General Public License
13
+ # along with this program; if not, contact SUSE LLC.
14
+ #
15
+ # To contact SUSE about this file by physical or electronic mail,
16
+ # you may find current contact information at www.suse.com
17
+
18
+ class Object
19
+ def try(*args)
20
+ send(*args)
21
+ end
22
+ end
23
+
24
+ class NilClass
25
+ def try(*_args)
26
+ nil
27
+ end
28
+ end
data/lib/version.rb CHANGED
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Machinery
19
19
 
20
- VERSION = "1.14.2"
20
+ VERSION = "1.15.0"
21
21
 
22
22
  end
@@ -2,4 +2,4 @@
2
2
 
3
3
  package main
4
4
 
5
- const VERSION = "b8c8eec01238e18a5ce1d9c53590c5c971e01703"
5
+ const VERSION = "b333b1358568df9a508e7d92c61d3280395911d9"
Binary file
@@ -241,22 +241,36 @@ scope to <code>packages</code>. This will output only the requested information.
241
241
  <p>Machinery supports the following scopes:</p>
242
242
 
243
243
  <ul>
244
- <li><p>os</p>
244
+ <li>os</li>
245
+ </ul>
246
+
245
247
 
246
248
  <p>Contains information about the operating system, name, version, and
247
- architecture of the inspected system.</p></li>
248
- <li><p>packages</p>
249
+ architecture of the inspected system.</p>
250
+
251
+ <ul>
252
+ <li>packages</li>
253
+ </ul>
254
+
249
255
 
250
256
  <p>Contains information on all installed RPM packages installed on the
251
- inspected system.</p></li>
252
- <li><p>patterns</p>
257
+ inspected system.</p>
258
+
259
+ <ul>
260
+ <li>patterns</li>
261
+ </ul>
262
+
253
263
 
254
264
  <p>Contains all patterns installed on the inspected system. A pattern is a
255
265
  collection of software packages.
256
266
  The meaning of software patterns depends on the package manager of the
257
267
  distribution. Therefore, the pattern scope on SUSE based systems uses the
258
- <code>zypper</code> command to obtain the information about installed pattern names.</p></li>
259
- <li><p>repositories</p>
268
+ <code>zypper</code> command to obtain the information about installed pattern names.</p>
269
+
270
+ <ul>
271
+ <li>repositories</li>
272
+ </ul>
273
+
260
274
 
261
275
  <p>Contains all information about software repositories configured on the
262
276
  inspected system. The information about repositories depends on the package
@@ -277,40 +291,60 @@ this repository should be checked by their gpg key or not.</p></li>
277
291
  <li><p>A numeric value for a priority. The priority of a repository is compared
278
292
  to the priorities of all other activated repositories. Values can
279
293
  range from 1 (highest) to 99 (lowest, default).</p></li>
294
+ <li><p>users</p></li>
280
295
  </ul>
281
- </li>
282
- <li><p>users</p>
296
+
283
297
 
284
298
  <p>Contains information about the system users including user and group ids,
285
299
  login information, such as password hashes and - if available - additional
286
- password properties.</p></li>
287
- <li><p>groups</p>
300
+ password properties.</p>
301
+
302
+ <ul>
303
+ <li>groups</li>
304
+ </ul>
305
+
288
306
 
289
307
  <p>Contains information about the system groups such as group attributes and the
290
- list of group members.</p></li>
291
- <li><p>services</p>
308
+ list of group members.</p>
309
+
310
+ <ul>
311
+ <li>services</li>
312
+ </ul>
313
+
292
314
 
293
315
  <p>Services are applications running in the background doing continuous work
294
316
  or waiting for requests to do work.
295
317
  The scope determines which services are configured to be started in which
296
318
  runlevel. It uses the <code>chkconfig</code> command to obtain that information.
297
319
  The xinetd services that are also displayed by <code>chkconfig</code> are switched
298
- on/off by editing config files and are ignored in this context.</p></li>
299
- <li><p>config_files</p>
320
+ on/off by editing config files and are ignored in this context.</p>
321
+
322
+ <ul>
323
+ <li>config_files</li>
324
+ </ul>
325
+
300
326
 
301
327
  <p>Contains all configuration files which have been changed since they were
302
328
  installed.
303
329
  Configuration files are all those files which are marked as such in the
304
330
  package which has installed them. A configuration file change is reported
305
331
  if its content or its attributes like Linux permission bits or ownership
306
- have changed.</p></li>
307
- <li><p>changed_managed_files</p>
332
+ have changed.</p>
333
+
334
+ <ul>
335
+ <li>changed_managed_files</li>
336
+ </ul>
337
+
308
338
 
309
339
  <p>Contains the names and contents of all non-configuration files which have
310
340
  been changed compared to the files in the package. A file change is reported
311
341
  if its content or its attributes like Linux permission bits or ownership
312
- have changed.</p></li>
313
- <li><p>unmanaged_files</p>
342
+ have changed.</p>
343
+
344
+ <ul>
345
+ <li>unmanaged_files</li>
346
+ </ul>
347
+
314
348
 
315
349
  <p>Contains the names and contents of all files which are not part of any RPM
316
350
  package. The list of unmanaged files contains only plain files and
@@ -325,9 +359,7 @@ extracted during inspection.</p>
325
359
 
326
360
  <p>Using the <code>--extract-unmanaged-files</code> option, the files are transferred from
327
361
  the system and stored in the system description. Depending on the content of
328
- the inspected system, the amount of data stored may be huge.</p></li>
329
- </ul>
330
-
362
+ the inspected system, the amount of data stored may be huge.</p>
331
363
 
332
364
  <h3 id="System-Description">System Description</h3>
333
365
 
@@ -1,3 +1,7 @@
1
+ ---
2
+ :name: Changed Managed Files
3
+ :initials: cmf
4
+ :description: |
1
5
  Contains the names and contents of all non-configuration files which have
2
6
  been changed compared to the files in the package. A file change is reported
3
7
  if its content or its attributes like Linux permission bits or ownership
@@ -20,6 +20,20 @@ end
20
20
 
21
21
  class ChangedManagedFileList < Machinery::Array
22
22
  has_elements class: ChangedManagedFile
23
+
24
+ def compare_with(other)
25
+ only_self = self - other
26
+ only_other = other - self
27
+ common = self & other
28
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
29
+
30
+ [
31
+ only_self,
32
+ only_other,
33
+ changed,
34
+ common
35
+ ].map { |e| (e && !e.empty?) ? e : nil }
36
+ end
23
37
  end
24
38
 
25
39
  class ChangedManagedFilesScope < FileScope
@@ -50,4 +50,21 @@ class ChangedManagedFilesRenderer < Renderer
50
50
  def display_name
51
51
  "Changed managed files"
52
52
  end
53
+
54
+ def compare_content_changed(changed_elements)
55
+ list do
56
+ changed_elements.each do |one, two|
57
+ changes = []
58
+ relevant_attributes = (one.attributes.keys & two.attributes.keys)
59
+
60
+ relevant_attributes.each do |attribute|
61
+ if one[attribute] != two[attribute]
62
+ changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
63
+ end
64
+ end
65
+
66
+ item "#{one.name} (#{changes.join(", ")})"
67
+ end
68
+ end
69
+ end
53
70
  end
@@ -1,3 +1,7 @@
1
+ ---
2
+ :name: Config Files
3
+ :initials: cf
4
+ :description: |
1
5
  Contains all configuration files which have been changed since they were
2
6
  installed.
3
7
  Configuration files are all those files which are marked as such in the
@@ -20,6 +20,20 @@ end
20
20
 
21
21
  class ConfigFileList < Machinery::Array
22
22
  has_elements class: ConfigFile
23
+
24
+ def compare_with(other)
25
+ only_self = self - other
26
+ only_other = other - self
27
+ common = self & other
28
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
29
+
30
+ [
31
+ only_self,
32
+ only_other,
33
+ changed,
34
+ common
35
+ ].map { |e| (e && !e.empty?) ? e : nil }
36
+ end
23
37
  end
24
38
 
25
39
  class ConfigFilesScope < FileScope
@@ -55,6 +55,23 @@ class ConfigFilesRenderer < Renderer
55
55
  "Changed configuration files"
56
56
  end
57
57
 
58
+ def compare_content_changed(changed_elements)
59
+ list do
60
+ changed_elements.each do |one, two|
61
+ changes = []
62
+ relevant_attributes = (one.attributes.keys & two.attributes.keys)
63
+
64
+ relevant_attributes.each do |attribute|
65
+ if one[attribute] != two[attribute]
66
+ changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
67
+ end
68
+ end
69
+
70
+ item "#{one.name} (#{changes.join(", ")})"
71
+ end
72
+ end
73
+ end
74
+
58
75
  private
59
76
 
60
77
  def render_diff_file(diffs_dir, name)
@@ -1,2 +1,6 @@
1
+ ---
2
+ :name: Groups
3
+ :initials: g
4
+ :description: |
1
5
  Contains information about the system groups such as group attributes and the
2
6
  list of group members.
@@ -23,4 +23,18 @@ class GroupsScope < Machinery::Array
23
23
  include Machinery::Scope
24
24
 
25
25
  has_elements class: Group
26
+
27
+ def compare_with(other)
28
+ only_self = self - other
29
+ only_other = other - self
30
+ common = self & other
31
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
32
+
33
+ [
34
+ only_self,
35
+ only_other,
36
+ changed,
37
+ common
38
+ ].map { |e| (e && !e.empty?) ? e : nil }
39
+ end
26
40
  end
@@ -33,4 +33,21 @@ class GroupsRenderer < Renderer
33
33
  def display_name
34
34
  "Groups"
35
35
  end
36
+
37
+ def compare_content_changed(changed_elements)
38
+ list do
39
+ changed_elements.each do |one, two|
40
+ changes = []
41
+ relevant_attributes = one.attributes.keys
42
+
43
+ relevant_attributes.each do |attribute|
44
+ if one[attribute] != two[attribute]
45
+ changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
46
+ end
47
+ end
48
+
49
+ item "#{one.name} (#{changes.join(", ")})"
50
+ end
51
+ end
52
+ end
36
53
  end
@@ -1,2 +1,6 @@
1
+ ---
2
+ :name: Operating System
3
+ :initials: os
4
+ :description: |
1
5
  Contains information about the operating system, name, version, and
2
6
  architecture of the inspected system.
@@ -1,2 +1,6 @@
1
+ ---
2
+ :name: Packages
3
+ :initials: pk
4
+ :description: |
1
5
  Contains information on all installed RPM packages installed on the
2
6
  inspected system.
@@ -28,18 +28,7 @@ class PackagesScope < Machinery::Array
28
28
  only_self = self - other
29
29
  only_other = other - self
30
30
  common = self & other
31
-
32
- changed_package_names = only_self.map(&:name) & only_other.map(&:name)
33
- changed = []
34
-
35
- changed_package_names.each do |name|
36
- changed << [
37
- only_self.find { |package| package.name == name },
38
- only_other.find { |package| package.name == name },
39
- ]
40
- only_self.reject! { |package| package.name == name }
41
- only_other.reject! { |package| package.name == name }
42
- end
31
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
43
32
 
44
33
  [
45
34
  only_self,
@@ -1,3 +1,7 @@
1
+ ---
2
+ :name: Patterns
3
+ :initials: pt
4
+ :description: |
1
5
  Contains all patterns installed on the inspected system. A pattern is a
2
6
  collection of software packages.
3
7
  The meaning of software patterns depends on the package manager of the
@@ -23,4 +23,18 @@ class PatternsScope < Machinery::Array
23
23
  include Machinery::Scope
24
24
 
25
25
  has_elements class: Pattern
26
+
27
+ def compare_with(other)
28
+ only_self = self - other
29
+ only_other = other - self
30
+ common = self & other
31
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
32
+
33
+ [
34
+ only_self,
35
+ only_other,
36
+ changed,
37
+ common
38
+ ].map { |e| (e && !e.empty?) ? e : nil }
39
+ end
26
40
  end
@@ -29,4 +29,25 @@ class PatternsRenderer < Renderer
29
29
  def display_name
30
30
  "Patterns"
31
31
  end
32
+
33
+ def compare_content_changed(changed_elements)
34
+ list do
35
+ changed_elements.each do |one, two|
36
+ changes = []
37
+ relevant_attributes = ["version"]
38
+
39
+ if one.version == two.version
40
+ relevant_attributes << "release"
41
+ end
42
+
43
+ relevant_attributes.each do |attribute|
44
+ if one[attribute] != two[attribute]
45
+ changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
46
+ end
47
+ end
48
+
49
+ item "#{one.name} (#{changes.join(", ")})"
50
+ end
51
+ end
52
+ end
32
53
  end