machinery-tool 1.22.1 → 1.22.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/.git_revision +1 -1
  3. data/NEWS +10 -0
  4. data/bin/machinery +1 -1
  5. data/lib/analyze_changed_config_files_diffs_task.rb +6 -6
  6. data/lib/autoyast.rb +2 -2
  7. data/lib/build_task.rb +10 -7
  8. data/lib/cli.rb +1005 -801
  9. data/lib/compare_task.rb +11 -7
  10. data/lib/comparison.rb +2 -2
  11. data/lib/config_base.rb +1 -1
  12. data/lib/config_task.rb +1 -1
  13. data/lib/containerize_task.rb +3 -3
  14. data/lib/containerized_app.rb +1 -1
  15. data/lib/copy_task.rb +1 -1
  16. data/lib/current_user.rb +1 -1
  17. data/lib/deploy_task.rb +6 -4
  18. data/lib/diff_widget.rb +67 -63
  19. data/lib/docker_system.rb +12 -8
  20. data/lib/dpkg_database.rb +1 -1
  21. data/lib/element_filter.rb +7 -4
  22. data/lib/exceptions.rb +23 -5
  23. data/lib/export_task.rb +1 -1
  24. data/lib/exporter.rb +1 -1
  25. data/lib/file_diff.rb +1 -1
  26. data/lib/file_scope.rb +1 -1
  27. data/lib/file_validator.rb +7 -4
  28. data/lib/filter.rb +97 -93
  29. data/lib/filter_option_parser.rb +2 -2
  30. data/lib/hint.rb +64 -59
  31. data/lib/html.rb +1 -1
  32. data/lib/inspect_task.rb +12 -12
  33. data/lib/inspector.rb +3 -3
  34. data/lib/json_validation_error_cleaner.rb +1 -1
  35. data/lib/json_validator.rb +4 -4
  36. data/lib/kiwi_config.rb +8 -4
  37. data/lib/list_task.rb +10 -9
  38. data/lib/local_system.rb +11 -5
  39. data/lib/logged_cheetah.rb +1 -1
  40. data/lib/man_task.rb +10 -6
  41. data/lib/managed_files_database.rb +1 -1
  42. data/lib/manifest.rb +5 -5
  43. data/lib/migration.rb +16 -10
  44. data/lib/mountpoints.rb +1 -1
  45. data/lib/move_task.rb +1 -1
  46. data/lib/remote_system.rb +7 -7
  47. data/lib/remove_task.rb +1 -1
  48. data/lib/renderer.rb +177 -172
  49. data/lib/rpm.rb +4 -4
  50. data/lib/rpm_database.rb +1 -1
  51. data/lib/scope.rb +2 -2
  52. data/lib/scope_file_access_archive.rb +1 -1
  53. data/lib/scope_file_access_flat.rb +1 -1
  54. data/lib/scope_file_store.rb +1 -1
  55. data/lib/serve_html_task.rb +6 -2
  56. data/lib/server.rb +19 -12
  57. data/lib/show_task.rb +10 -6
  58. data/lib/static_html.rb +1 -1
  59. data/lib/system.rb +10 -10
  60. data/lib/system_description.rb +14 -13
  61. data/lib/system_description_memory_store.rb +1 -1
  62. data/lib/system_description_store.rb +9 -9
  63. data/lib/tarball.rb +8 -2
  64. data/lib/upgrade_format_task.rb +11 -6
  65. data/lib/validate_task.rb +2 -2
  66. data/lib/version.rb +1 -1
  67. data/lib/workload_mapper.rb +2 -2
  68. data/lib/workload_mapper_dsl.rb +1 -1
  69. data/lib/zypper.rb +40 -17
  70. data/machinery-helper/machinery_helper.go +35 -16
  71. data/machinery-helper/version.go +1 -1
  72. data/man/generated/machinery.1.gz +0 -0
  73. data/manual/site/sitemap.xml +24 -24
  74. data/plugins/changed_config_files/changed_config_files_inspector.rb +59 -56
  75. data/plugins/changed_config_files/changed_config_files_model.rb +23 -21
  76. data/plugins/changed_config_files/changed_config_files_renderer.rb +56 -52
  77. data/plugins/changed_managed_files/changed_managed_files_inspector.rb +52 -50
  78. data/plugins/changed_managed_files/changed_managed_files_model.rb +23 -21
  79. data/plugins/changed_managed_files/changed_managed_files_renderer.rb +43 -39
  80. data/plugins/environment/environment_inspector.rb +25 -23
  81. data/plugins/environment/environment_model.rb +5 -3
  82. data/plugins/groups/groups_inspector.rb +30 -28
  83. data/plugins/groups/groups_model.rb +18 -17
  84. data/plugins/groups/groups_renderer.rb +29 -25
  85. data/plugins/os/os_inspector.rb +120 -118
  86. data/plugins/os/os_model.rb +139 -134
  87. data/plugins/os/os_renderer.rb +13 -9
  88. data/plugins/packages/packages_inspector.rb +99 -86
  89. data/plugins/packages/packages_model.rb +35 -34
  90. data/plugins/packages/packages_renderer.rb +47 -39
  91. data/plugins/patterns/patterns_inspector.rb +70 -68
  92. data/plugins/patterns/patterns_model.rb +19 -18
  93. data/plugins/patterns/patterns_renderer.rb +36 -32
  94. data/plugins/repositories/repositories_inspector.rb +162 -156
  95. data/plugins/repositories/repositories_model.rb +50 -49
  96. data/plugins/repositories/repositories_renderer.rb +48 -44
  97. data/plugins/repositories/schema/system-description-repositories.schema-v10.json +0 -1
  98. data/plugins/services/services_inspector.rb +187 -176
  99. data/plugins/services/services_model.rb +37 -36
  100. data/plugins/services/services_renderer.rb +28 -24
  101. data/plugins/unmanaged_files/unmanaged_files_inspector.rb +102 -99
  102. data/plugins/unmanaged_files/unmanaged_files_model.rb +64 -56
  103. data/plugins/unmanaged_files/unmanaged_files_renderer.rb +44 -40
  104. data/plugins/users/users_inspector.rb +67 -65
  105. data/plugins/users/users_model.rb +37 -36
  106. data/plugins/users/users_renderer.rb +31 -27
  107. data/schema/migrations/migrate1to2.rb +1 -1
  108. data/schema/migrations/migrate2to3.rb +1 -1
  109. data/schema/migrations/migrate3to4.rb +1 -1
  110. data/schema/migrations/migrate4to5.rb +1 -1
  111. data/schema/migrations/migrate5to6.rb +1 -1
  112. data/schema/migrations/migrate6to7.rb +1 -1
  113. data/schema/migrations/migrate7to8.rb +1 -1
  114. data/schema/migrations/migrate8to9.rb +1 -1
  115. data/schema/migrations/migrate9to10.rb +1 -1
  116. metadata +2 -2
@@ -15,45 +15,46 @@
15
15
  # To contact SUSE about this file by physical or electronic mail,
16
16
  # you may find current contact information at www.suse.com
17
17
 
18
+ module Machinery
19
+ class Package < Machinery::Object
20
+ end
18
21
 
19
- class Package < Machinery::Object
20
- end
21
-
22
- class RpmPackage < Package
23
- end
22
+ class RpmPackage < Package
23
+ end
24
24
 
25
- class DpkgPackage < Package
26
- end
25
+ class DpkgPackage < Package
26
+ end
27
27
 
28
- class PackagesScope < Machinery::Array
29
- include Machinery::Scope
30
-
31
- has_attributes :package_system
32
- has_elements class: DpkgPackage, if: { package_system: "dpkg" }
33
- has_elements class: RpmPackage, if: { package_system: "rpm" }
34
-
35
- def compare_with(other)
36
- if self.package_system != other.package_system
37
- [self, other, nil, nil]
38
- else
39
- only_self = self - other
40
- only_other = other - self
41
- common = self & other
42
- changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
43
- changed = nil if changed.empty?
44
-
45
- [
46
- package_list_to_scope(only_self),
47
- package_list_to_scope(only_other),
48
- changed,
49
- package_list_to_scope(common)
50
- ].map { |e| (e && !e.empty?) ? e : nil }
28
+ class PackagesScope < Machinery::Array
29
+ include Machinery::Scope
30
+
31
+ has_attributes :package_system
32
+ has_elements class: DpkgPackage, if: { package_system: "dpkg" }
33
+ has_elements class: RpmPackage, if: { package_system: "rpm" }
34
+
35
+ def compare_with(other)
36
+ if package_system != other.package_system
37
+ [self, other, nil, nil]
38
+ else
39
+ only_self = self - other
40
+ only_other = other - self
41
+ common = self & other
42
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
43
+ changed = nil if changed.empty?
44
+
45
+ [
46
+ package_list_to_scope(only_self),
47
+ package_list_to_scope(only_other),
48
+ changed,
49
+ package_list_to_scope(common)
50
+ ].map { |e| e && !e.empty? ? e : nil }
51
+ end
51
52
  end
52
- end
53
53
 
54
- private
54
+ private
55
55
 
56
- def package_list_to_scope(packages)
57
- self.class.new(packages, package_system: package_system) unless packages.elements.empty?
56
+ def package_list_to_scope(packages)
57
+ self.class.new(packages, package_system: package_system) unless packages.elements.empty?
58
+ end
58
59
  end
59
60
  end
@@ -15,57 +15,65 @@
15
15
  # To contact SUSE about this file by physical or electronic mail,
16
16
  # you may find current contact information at www.suse.com
17
17
 
18
- class PackagesRenderer < Renderer
19
- def display_name
20
- "Packages"
21
- end
18
+ module Machinery
19
+ class Ui
20
+ class PackagesRenderer < Machinery::Ui::Renderer
21
+ def display_name
22
+ "Packages"
23
+ end
22
24
 
23
- def content(description)
24
- return unless description.packages
25
+ def content(description)
26
+ return unless description.packages
25
27
 
26
- if description.packages.elements.empty?
27
- puts "There are no packages."
28
- end
28
+ if description.packages.elements.empty?
29
+ puts "There are no packages."
30
+ end
29
31
 
30
- na_note("package vendor") if description.packages.any? { |a| a[:vendor] == "" }
32
+ na_note("package vendor") if description.packages.any? { |a| a[:vendor] == "" }
31
33
 
32
- list do
33
- description.packages.each do |p|
34
- vendor = !p.vendor.empty? ? p.vendor : "N/A"
35
- item [p.name, p.version, p.release].reject(&:empty?).join("-") + ".#{p.arch} (#{vendor})"
34
+ list do
35
+ description.packages.each do |p|
36
+ vendor = !p.vendor.empty? ? p.vendor : "N/A"
37
+ item [
38
+ p.name,
39
+ p.version,
40
+ p.release
41
+ ].reject(&:empty?).join("-") + ".#{p.arch} (#{vendor})"
42
+ end
43
+ end
36
44
  end
37
- end
38
- end
39
45
 
40
- # In the comparison case we only want to show the package name, not all details like version,
41
- # architecture etc.
42
- def compare_content_only_in(description)
43
- return if description.packages.empty?
46
+ # In the comparison case we only want to show the package name, not all details like version,
47
+ # architecture etc.
48
+ def compare_content_only_in(description)
49
+ return if description.packages.empty?
44
50
 
45
- list do
46
- description.packages.each do |p|
47
- item "#{p.name}"
51
+ list do
52
+ description.packages.each do |p|
53
+ item p.name.to_s
54
+ end
55
+ end
48
56
  end
49
- end
50
- end
51
57
 
52
- def compare_content_changed(changed_elements)
53
- list do
54
- changed_elements.each do |one, two|
55
- changes = []
56
- relevant_attributes = ["version", "vendor", "arch"]
57
- if one.version == two.version
58
- relevant_attributes << "release"
59
- relevant_attributes << "checksum" if one.release == two.release
60
- end
58
+ def compare_content_changed(changed_elements)
59
+ list do
60
+ changed_elements.each do |one, two|
61
+ changes = []
62
+ relevant_attributes = ["version", "vendor", "arch"]
63
+ if one.version == two.version
64
+ relevant_attributes << "release"
65
+ relevant_attributes << "checksum" if one.release == two.release
66
+ end
67
+
68
+ relevant_attributes.each do |attribute|
69
+ if one[attribute] != two[attribute]
70
+ changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
71
+ end
72
+ end
61
73
 
62
- relevant_attributes.each do |attribute|
63
- if one[attribute] != two[attribute]
64
- changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
74
+ item "#{one.name} (#{changes.join(", ")})"
65
75
  end
66
76
  end
67
-
68
- item "#{one.name} (#{changes.join(", ")})"
69
77
  end
70
78
  end
71
79
  end
@@ -15,90 +15,92 @@
15
15
  # To contact SUSE about this file by physical or electronic mail,
16
16
  # you may find current contact information at www.suse.com
17
17
 
18
- class PatternsInspector < Inspector
19
- has_priority 30
20
- def initialize(system, description)
21
- @system = system
22
- @description = description
23
- end
18
+ module Machinery
19
+ class PatternsInspector < Machinery::Inspector
20
+ has_priority 30
21
+ def initialize(system, description)
22
+ @system = system
23
+ @description = description
24
+ end
24
25
 
25
- def inspect(_filter, _options = {})
26
- if @system.has_command?("zypper")
27
- @patterns_supported = true
28
- inspect_with_zypper
29
- elsif @system.has_command?("dpkg")
30
- if @system.has_command?("tasksel")
31
- Machinery::Ui.puts "Note: Tasks on Debian-like systems are treated as patterns."
26
+ def inspect(_filter, _options = {})
27
+ if @system.has_command?("zypper")
32
28
  @patterns_supported = true
33
- inspect_with_tasksel
29
+ inspect_with_zypper
30
+ elsif @system.has_command?("dpkg")
31
+ if @system.has_command?("tasksel")
32
+ Machinery::Ui.puts "Note: Tasks on Debian-like systems are treated as patterns."
33
+ @patterns_supported = true
34
+ inspect_with_tasksel
35
+ else
36
+ @patterns_supported = false
37
+ @status = "For a patterns (tasks) inspection please install the package tasksel " \
38
+ "on the inspected system."
39
+ @description.patterns = PatternsScope.new
40
+ end
34
41
  else
35
42
  @patterns_supported = false
36
- @status = "For a patterns (tasks) inspection please install the package tasksel " \
37
- "on the inspected system."
43
+ @status = "Patterns or tasks are not supported on this system."
38
44
  @description.patterns = PatternsScope.new
39
45
  end
40
- else
41
- @patterns_supported = false
42
- @status = "Patterns or tasks are not supported on this system."
43
- @description.patterns = PatternsScope.new
44
46
  end
45
- end
46
47
 
47
- def summary
48
- if @patterns_supported
49
- "Found #{Machinery.pluralize(@description.patterns.count, "%d pattern")}."
50
- else
51
- @status
48
+ def summary
49
+ if @patterns_supported
50
+ "Found #{Machinery.pluralize(@description.patterns.count, "%d pattern")}."
51
+ else
52
+ @status
53
+ end
52
54
  end
53
- end
54
55
 
55
- private
56
+ private
56
57
 
57
- def inspect_with_zypper
58
- begin
59
- xml = @system.run_command("zypper", "--non-interactive", "-xq", "--no-refresh", "patterns",
60
- "-i", stdout: :capture)
61
- rescue Cheetah::ExecutionFailed => e
62
- if e.stdout.include?("locked")
63
- Machinery.logger.error(e.stdout)
64
- raise Machinery::Errors::ZypperFailed.new(
65
- "Zypper is locked."
66
- )
67
- else
68
- raise
58
+ def inspect_with_zypper
59
+ begin
60
+ xml = @system.run_command("zypper", "--non-interactive", "-xq", "--no-refresh", "patterns",
61
+ "-i", stdout: :capture)
62
+ rescue Cheetah::ExecutionFailed => e
63
+ if e.stdout.include?("locked")
64
+ Machinery.logger.error(e.stdout)
65
+ raise Machinery::Errors::ZypperFailed.new(
66
+ "Zypper is locked."
67
+ )
68
+ else
69
+ raise
70
+ end
69
71
  end
70
- end
71
- pattern_list = REXML::Document.new(xml).get_elements("/stream/pattern-list/pattern")
72
+ pattern_list = REXML::Document.new(xml).get_elements("/stream/pattern-list/pattern")
72
73
 
73
- if pattern_list.count == 0
74
- @description.patterns = PatternsScope.new
75
- return
76
- end
74
+ if pattern_list.empty?
75
+ @description.patterns = PatternsScope.new
76
+ return
77
+ end
77
78
 
78
- patterns = pattern_list.map do |pattern|
79
- Pattern.new(
80
- name: pattern.attributes["name"],
81
- version: pattern.attributes["version"],
82
- release: pattern.attributes["release"]
83
- )
84
- end.uniq.sort_by(&:name)
79
+ patterns = pattern_list.map do |pattern|
80
+ Pattern.new(
81
+ name: pattern.attributes["name"],
82
+ version: pattern.attributes["version"],
83
+ release: pattern.attributes["release"]
84
+ )
85
+ end.uniq.sort_by(&:name)
85
86
 
86
- @description.patterns = PatternsScope.new(patterns)
87
- @description.patterns.attributes["patterns_system"] = "zypper"
88
- end
87
+ @description.patterns = PatternsScope.new(patterns)
88
+ @description.patterns.attributes["patterns_system"] = "zypper"
89
+ end
89
90
 
90
- def inspect_with_tasksel
91
- tasksel_out = @system.run_command("tasksel", "--list-tasks", stdout: :capture)
92
- tasklist = tasksel_out.lines.map(&:chomp)
93
- installed = tasklist.select { |line| line.start_with?("i") }
94
- installed.map! { |l| l.split[1] }
95
- patterns = installed.map do |pattern|
96
- Pattern.new(
97
- name: pattern
98
- )
99
- end.uniq.sort_by(&:name)
91
+ def inspect_with_tasksel
92
+ tasksel_out = @system.run_command("tasksel", "--list-tasks", stdout: :capture)
93
+ tasklist = tasksel_out.lines.map(&:chomp)
94
+ installed = tasklist.select { |line| line.start_with?("i") }
95
+ installed.map! { |l| l.split[1] }
96
+ patterns = installed.map do |pattern|
97
+ Pattern.new(
98
+ name: pattern
99
+ )
100
+ end.uniq.sort_by(&:name)
100
101
 
101
- @description.patterns = PatternsScope.new(patterns)
102
- @description.patterns.attributes["patterns_system"] = "tasksel"
102
+ @description.patterns = PatternsScope.new(patterns)
103
+ @description.patterns.attributes["patterns_system"] = "tasksel"
104
+ end
103
105
  end
104
106
  end
@@ -15,27 +15,28 @@
15
15
  # To contact SUSE about this file by physical or electronic mail,
16
16
  # you may find current contact information at www.suse.com
17
17
 
18
+ module Machinery
19
+ class Pattern < Machinery::Object
20
+ end
18
21
 
19
- class Pattern < Machinery::Object
20
- end
21
-
22
- class PatternsScope < Machinery::Array
23
- include Machinery::Scope
22
+ class PatternsScope < Machinery::Array
23
+ include Machinery::Scope
24
24
 
25
- has_attributes :patterns_system
26
- has_elements class: Pattern
25
+ has_attributes :patterns_system
26
+ has_elements class: Pattern
27
27
 
28
- def compare_with(other)
29
- only_self = self - other
30
- only_other = other - self
31
- common = self & other
32
- changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
28
+ def compare_with(other)
29
+ only_self = self - other
30
+ only_other = other - self
31
+ common = self & other
32
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
33
33
 
34
- [
35
- only_self,
36
- only_other,
37
- changed,
38
- common
39
- ].map { |e| (e && !e.empty?) ? e : nil }
34
+ [
35
+ only_self,
36
+ only_other,
37
+ changed,
38
+ common
39
+ ].map { |e| e && !e.empty? ? e : nil }
40
+ end
40
41
  end
41
42
  end
@@ -15,49 +15,53 @@
15
15
  # To contact SUSE about this file by physical or electronic mail,
16
16
  # you may find current contact information at www.suse.com
17
17
 
18
- class PatternsRenderer < Renderer
19
- def content(description)
20
- return unless description.patterns
18
+ module Machinery
19
+ class Ui
20
+ class PatternsRenderer < Machinery::Ui::Renderer
21
+ def content(description)
22
+ return unless description.patterns
21
23
 
22
- if description.patterns.empty?
23
- puts "There are no patterns or tasks."
24
- end
24
+ if description.patterns.empty?
25
+ puts "There are no patterns or tasks."
26
+ end
25
27
 
26
- if description.patterns.patterns_system == "tasksel"
27
- puts "Note: Tasks on Debian-like systems are treated as patterns."
28
- end
28
+ if description.patterns.patterns_system == "tasksel"
29
+ puts "Note: Tasks on Debian-like systems are treated as patterns."
30
+ end
29
31
 
30
- puts "Pattern Manager: #{description.patterns.patterns_system}" unless
31
- description.patterns.empty?
32
+ puts "Pattern Manager: #{description.patterns.patterns_system}" unless
33
+ description.patterns.empty?
32
34
 
33
- list do
34
- description.patterns.each do |p|
35
- item "#{p.name}"
35
+ list do
36
+ description.patterns.each do |p|
37
+ item p.name.to_s
38
+ end
39
+ end
36
40
  end
37
- end
38
- end
39
41
 
40
- def display_name
41
- "Patterns"
42
- end
42
+ def display_name
43
+ "Patterns"
44
+ end
43
45
 
44
- def compare_content_changed(changed_elements)
45
- list do
46
- changed_elements.each do |one, two|
47
- changes = []
48
- relevant_attributes = ["version"]
46
+ def compare_content_changed(changed_elements)
47
+ list do
48
+ changed_elements.each do |one, two|
49
+ changes = []
50
+ relevant_attributes = ["version"]
49
51
 
50
- if one.version == two.version
51
- relevant_attributes << "release"
52
- end
52
+ if one.version == two.version
53
+ relevant_attributes << "release"
54
+ end
55
+
56
+ relevant_attributes.each do |attribute|
57
+ if one[attribute] != two[attribute]
58
+ changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
59
+ end
60
+ end
53
61
 
54
- relevant_attributes.each do |attribute|
55
- if one[attribute] != two[attribute]
56
- changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
62
+ item "#{one.name} (#{changes.join(", ")})"
57
63
  end
58
64
  end
59
-
60
- item "#{one.name} (#{changes.join(", ")})"
61
65
  end
62
66
  end
63
67
  end