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,71 +15,74 @@
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 ChangedConfigFilesInspector < Inspector
19
- has_priority 80
18
+ module Machinery
19
+ class ChangedConfigFilesInspector < Machinery::Inspector
20
+ has_priority 80
20
21
 
21
- # returns a hash with entries for changed configuration files
22
- def config_file_changes(pkg)
23
- @system.changed_files.select(&:config_file?).map do |file|
24
- ConfigFile.new(
25
- name: file.path,
26
- package_name: package_name,
27
- package_version: package_version,
28
- status: "changed",
29
- changes: file.changes
30
- )
31
- end.uniq
32
- end
22
+ # returns a hash with entries for changed configuration files
23
+ def config_file_changes(_pkg)
24
+ @system.changed_files.select(&:config_file?).map do |file|
25
+ ConfigFile.new(
26
+ name: file.path,
27
+ package_name: package_name,
28
+ package_version: package_version,
29
+ status: "changed",
30
+ changes: file.changes
31
+ )
32
+ end.uniq
33
+ end
33
34
 
34
- def initialize(system, description)
35
- @system = system
36
- @description = description
37
- end
35
+ def initialize(system, description)
36
+ @system = system
37
+ @description = description
38
+ end
38
39
 
39
- def inspect(filter, options = {})
40
- do_extract = options[:extract_changed_changed_config_files]
41
- system.check_retrieve_files_dependencies if do_extract
40
+ def inspect(filter, options = {})
41
+ do_extract = options[:extract_changed_changed_config_files]
42
+ system.check_retrieve_files_dependencies if do_extract
42
43
 
43
- count = 0
44
- files = @system.managed_files_database.changed_files do |chunk|
45
- count += chunk.lines.count { |l| !l.chomp.end_with?(":") && l.split(" ")[1] == "c" }
46
- Machinery::Ui.progress(
47
- " -> Found #{Machinery.pluralize(count, "%d changed configuration file")}..."
48
- )
49
- end
50
- result = files.select(&:config_file?).map do |file|
51
- ConfigFile.new(file.attributes)
52
- end
44
+ count = 0
45
+ files = @system.managed_files_database.changed_files do |chunk|
46
+ count += chunk.lines.count { |l| !l.chomp.end_with?(":") && l.split(" ")[1] == "c" }
47
+ Machinery::Ui.progress(
48
+ " -> Found #{Machinery.pluralize(count, "%d changed configuration file")}..."
49
+ )
50
+ end
51
+ result = files.select(&:config_file?).map do |file|
52
+ ConfigFile.new(file.attributes)
53
+ end
53
54
 
54
- if filter
55
- file_filter = filter.element_filter_for("/changed_config_files/files/name")
56
- result.delete_if { |e| file_filter.matches?(e.name) } if file_filter
57
- end
55
+ if filter
56
+ file_filter = filter.element_filter_for("/changed_config_files/files/name")
57
+ result.delete_if { |e| file_filter.matches?(e.name) } if file_filter
58
+ end
58
59
 
59
- scope = ChangedConfigFilesScope.new
60
- file_store = @description.scope_file_store("changed_config_files")
61
- scope.scope_file_store = file_store
60
+ scope = ChangedConfigFilesScope.new
61
+ file_store = @description.scope_file_store("changed_config_files")
62
+ scope.scope_file_store = file_store
62
63
 
63
- file_store.remove
64
- if do_extract
65
- file_store.create
66
- extracted_paths = result.reject do |file|
67
- file.changes == ["deleted"] ||
68
- file.link? || file.directory?
69
- end.map(&:name)
70
- scope.retrieve_files_from_system(@system, extracted_paths)
71
- end
64
+ file_store.remove
65
+ if do_extract
66
+ file_store.create
67
+ extracted_paths = result.reject do |file|
68
+ file.changes == ["deleted"] ||
69
+ file.link? ||
70
+ file.directory?
71
+ end.map(&:name)
72
+ scope.retrieve_files_from_system(@system, extracted_paths)
73
+ end
72
74
 
73
- scope.extracted = !!do_extract
74
- scope += result.sort_by(&:name)
75
+ scope.extracted = !!do_extract
76
+ scope += result.sort_by(&:name)
75
77
 
76
- @description["changed_config_files"] = scope
77
- end
78
+ @description["changed_config_files"] = scope
79
+ end
78
80
 
79
- def summary
80
- "#{@description.changed_config_files.extracted ? "Extracted" : "Found"} " +
81
- Machinery.pluralize(
82
- @description.changed_config_files.count, "%d changed configuration file"
83
- ) + "."
81
+ def summary
82
+ "#{@description.changed_config_files.extracted ? "Extracted" : "Found"} " +
83
+ Machinery.pluralize(
84
+ @description.changed_config_files.count, "%d changed configuration file"
85
+ ) + "."
86
+ end
84
87
  end
85
88
  end
@@ -15,31 +15,33 @@
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 ConfigFile < Machinery::SystemFile
19
- end
18
+ module Machinery
19
+ class ConfigFile < Machinery::SystemFile
20
+ end
20
21
 
21
- class ConfigFileList < Machinery::Array
22
- has_elements class: ConfigFile
22
+ class ConfigFileList < Machinery::Array
23
+ has_elements class: ConfigFile
23
24
 
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)
25
+ def compare_with(other)
26
+ only_self = self - other
27
+ only_other = other - self
28
+ common = self & other
29
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
29
30
 
30
- [
31
- only_self,
32
- only_other,
33
- changed,
34
- common
35
- ].map { |e| (e && !e.empty?) ? e : nil }
31
+ [
32
+ only_self,
33
+ only_other,
34
+ changed,
35
+ common
36
+ ].map { |e| e && !e.empty? ? e : nil }
37
+ end
36
38
  end
37
- end
38
39
 
39
- class ChangedConfigFilesScope < FileScope
40
- include Machinery::Scope
41
- include ScopeFileAccessFlat
40
+ class ChangedConfigFilesScope < Machinery::FileScope
41
+ include Machinery::Scope
42
+ include Machinery::ScopeFileAccessFlat
42
43
 
43
- has_attributes :extracted
44
- has_elements class: ConfigFile
44
+ has_attributes :extracted
45
+ has_elements class: ConfigFile
46
+ end
45
47
  end
@@ -15,76 +15,80 @@
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 ChangedConfigFilesRenderer < Renderer
19
- def content(description)
20
- return unless description["changed_config_files"]
18
+ module Machinery
19
+ class Ui
20
+ class ChangedConfigFilesRenderer < Machinery::Ui::Renderer
21
+ def content(description)
22
+ return unless description["changed_config_files"]
21
23
 
22
- diffs_dir = description.scope_file_store("analyze/changed_config_files_diffs").path
24
+ diffs_dir = description.scope_file_store("analyze/changed_config_files_diffs").path
23
25
 
24
- if !diffs_dir && @options[:show_diffs]
25
- raise Machinery::Errors::SystemDescriptionError.new(
26
- "Diffs can not be shown because they were not generated yet.\n" \
27
- "You can generate them with `#{Hint.program_name} analyze" \
28
- " --operation=changed-config-files-diffs #{description.name}`."
29
- )
30
- end
26
+ if !diffs_dir && @options[:show_diffs]
27
+ raise Machinery::Errors::SystemDescriptionError.new(
28
+ "Diffs can not be shown because they were not generated yet.\n" \
29
+ "You can generate them with `#{Machinery::Ui::Hint.program_name} analyze" \
30
+ " --operation=changed-config-files-diffs #{description.name}`."
31
+ )
32
+ end
31
33
 
32
- list do
33
- file_status = description["changed_config_files"].extracted
34
- files = description["changed_config_files"]
34
+ list do
35
+ file_status = description["changed_config_files"].extracted
36
+ files = description["changed_config_files"]
35
37
 
36
- if files.elements.empty?
37
- puts "There are no changed configuration files."
38
- elsif !file_status.nil?
39
- puts "Files extracted: #{file_status ? "yes" : "no"}"
40
- end
38
+ if files.elements.empty?
39
+ puts "There are no changed configuration files."
40
+ elsif !file_status.nil?
41
+ puts "Files extracted: #{file_status ? "yes" : "no"}"
42
+ end
41
43
 
42
- if files
43
- files.each do |p|
44
- item_content = "#{p.name} (#{p.package_name}-#{p.package_version}, " \
45
- "#{p.changes.join(", ")})"
46
- if @options[:show_diffs] && p.changes.include?("md5")
47
- item item_content do
48
- render_diff_file(diffs_dir, p.name)
44
+ if files
45
+ files.each do |p|
46
+ item_content = "#{p.name} (#{p.package_name}-#{p.package_version}, " \
47
+ "#{p.changes.join(", ")})"
48
+ if @options[:show_diffs] && p.changes.include?("md5")
49
+ item item_content do
50
+ render_diff_file(diffs_dir, p.name)
51
+ end
52
+ else
53
+ item item_content
54
+ end
49
55
  end
50
- else
51
- item item_content
52
56
  end
53
57
  end
54
58
  end
55
- end
56
- end
57
59
 
58
- def display_name
59
- "Changed Configuration Files"
60
- end
60
+ def display_name
61
+ "Changed Configuration Files"
62
+ end
61
63
 
62
- def compare_content_changed(changed_elements)
63
- list do
64
- changed_elements.each do |one, two|
65
- changes = []
66
- relevant_attributes = (one.attributes.keys & two.attributes.keys)
64
+ def compare_content_changed(changed_elements)
65
+ list do
66
+ changed_elements.each do |one, two|
67
+ changes = []
68
+ relevant_attributes = (one.attributes.keys & two.attributes.keys)
67
69
 
68
- relevant_attributes.each do |attribute|
69
- if one[attribute] != two[attribute]
70
- changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
70
+ relevant_attributes.each do |attribute|
71
+ if one[attribute] != two[attribute]
72
+ changes << "#{attribute}: #{one[attribute]} <> #{two[attribute]}"
73
+ end
74
+ end
75
+
76
+ item "#{one.name} (#{changes.join(", ")})"
71
77
  end
72
78
  end
73
-
74
- item "#{one.name} (#{changes.join(", ")})"
75
79
  end
76
- end
77
- end
78
80
 
79
- private
81
+ private
80
82
 
81
- def render_diff_file(diffs_dir, name)
82
- path = File.join(diffs_dir, name + ".diff")
83
+ def render_diff_file(diffs_dir, name)
84
+ path = File.join(diffs_dir, name + ".diff")
83
85
 
84
- if File.exist?(path)
85
- puts "Diff:\n#{File.read(path).chomp}"
86
- else
87
- Machinery::Ui.warn "Diff for #{name} was not found on disk."
86
+ if File.exist?(path)
87
+ puts "Diff:\n#{File.read(path).chomp}"
88
+ else
89
+ Machinery::Ui.warn "Diff for #{name} was not found on disk."
90
+ end
91
+ end
88
92
  end
89
93
  end
90
94
  end
@@ -15,70 +15,72 @@
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 ChangedManagedFilesInspector < Inspector
19
- has_priority 90
18
+ module Machinery
19
+ class ChangedManagedFilesInspector < Machinery::Inspector
20
+ has_priority 90
20
21
 
21
- def initialize(system, description)
22
- @system = system
23
- @description = description
24
- end
25
-
26
- def inspect(filter, options = {})
27
- system.check_retrieve_files_dependencies if options[:extract_changed_managed_files]
22
+ def initialize(system, description)
23
+ @system = system
24
+ @description = description
25
+ end
28
26
 
29
- @system = system
27
+ def inspect(filter, options = {})
28
+ system.check_retrieve_files_dependencies if options[:extract_changed_managed_files]
30
29
 
31
- scope = ChangedManagedFilesScope.new
32
- file_store = @description.scope_file_store("changed_managed_files")
33
- scope.scope_file_store = file_store
30
+ @system = system
34
31
 
35
- result = changed_files
32
+ scope = ChangedManagedFilesScope.new
33
+ file_store = @description.scope_file_store("changed_managed_files")
34
+ scope.scope_file_store = file_store
36
35
 
37
- if filter
38
- file_filter = filter.element_filter_for("/changed_managed_files/files/name")
39
- result.delete_if { |e| file_filter.matches?(e.name) } if file_filter
40
- end
36
+ result = changed_files
41
37
 
42
- file_store.remove
43
- if options[:extract_changed_managed_files]
44
- file_store.create
45
-
46
- existing_files = result.reject do |f|
47
- f.changes.nil? ||
48
- f.changes.include?("deleted") ||
49
- f.link? ||
50
- f.directory? ||
51
- f.name == "/"
38
+ if filter
39
+ file_filter = filter.element_filter_for("/changed_managed_files/files/name")
40
+ result.delete_if { |e| file_filter.matches?(e.name) } if file_filter
52
41
  end
53
42
 
54
- scope.retrieve_files_from_system(@system, existing_files.map(&:name))
55
- end
43
+ file_store.remove
44
+ if options[:extract_changed_managed_files]
45
+ file_store.create
56
46
 
57
- scope.extracted = !!options[:extract_changed_managed_files]
58
- scope += result.sort_by(&:name)
47
+ existing_files = result.reject do |f|
48
+ f.changes.nil? ||
49
+ f.changes.include?("deleted") ||
50
+ f.link? ||
51
+ f.directory? ||
52
+ f.name == "/"
53
+ end
59
54
 
60
- @description["changed_managed_files"] = scope
61
- end
55
+ scope.retrieve_files_from_system(@system, existing_files.map(&:name))
56
+ end
62
57
 
63
- def summary
64
- "#{@description.changed_managed_files.extracted ? "Extracted" : "Found"} " +
65
- Machinery.pluralize(
66
- @description.changed_managed_files.count, "%d changed managed file"
67
- ) + "."
68
- end
58
+ scope.extracted = !!options[:extract_changed_managed_files]
59
+ scope += result.sort_by(&:name)
69
60
 
70
- private
61
+ @description["changed_managed_files"] = scope
62
+ end
71
63
 
72
- def changed_files
73
- count = 0
74
- files = @system.managed_files_database.changed_files do |chunk|
75
- count += chunk.lines.reject { |l| l.chomp.end_with?(":") || l.split(" ")[1] == "c" }.count
76
- Machinery::Ui.progress(
77
- " -> Found #{Machinery.pluralize(count, "%d changed managed file")}..."
78
- )
64
+ def summary
65
+ "#{@description.changed_managed_files.extracted ? "Extracted" : "Found"} " +
66
+ Machinery.pluralize(
67
+ @description.changed_managed_files.count, "%d changed managed file"
68
+ ) + "."
79
69
  end
80
- files.reject(&:config_file?).map do |file|
81
- ChangedManagedFile.new(file.attributes)
70
+
71
+ private
72
+
73
+ def changed_files
74
+ count = 0
75
+ files = @system.managed_files_database.changed_files do |chunk|
76
+ count += chunk.lines.reject { |l| l.chomp.end_with?(":") || l.split(" ")[1] == "c" }.count
77
+ Machinery::Ui.progress(
78
+ " -> Found #{Machinery.pluralize(count, "%d changed managed file")}..."
79
+ )
80
+ end
81
+ files.reject(&:config_file?).map do |file|
82
+ ChangedManagedFile.new(file.attributes)
83
+ end
82
84
  end
83
85
  end
84
86
  end
@@ -15,31 +15,33 @@
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 ChangedManagedFile < Machinery::SystemFile
19
- end
18
+ module Machinery
19
+ class ChangedManagedFile < Machinery::SystemFile
20
+ end
20
21
 
21
- class ChangedManagedFileList < Machinery::Array
22
- has_elements class: ChangedManagedFile
22
+ class ChangedManagedFileList < Machinery::Array
23
+ has_elements class: ChangedManagedFile
23
24
 
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)
25
+ def compare_with(other)
26
+ only_self = self - other
27
+ only_other = other - self
28
+ common = self & other
29
+ changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
29
30
 
30
- [
31
- only_self,
32
- only_other,
33
- changed,
34
- common
35
- ].map { |e| (e && !e.empty?) ? e : nil }
31
+ [
32
+ only_self,
33
+ only_other,
34
+ changed,
35
+ common
36
+ ].map { |e| e && !e.empty? ? e : nil }
37
+ end
36
38
  end
37
- end
38
39
 
39
- class ChangedManagedFilesScope < FileScope
40
- include Machinery::Scope
41
- include ScopeFileAccessFlat
40
+ class ChangedManagedFilesScope < Machinery::FileScope
41
+ include Machinery::Scope
42
+ include Machinery::ScopeFileAccessFlat
42
43
 
43
- has_attributes :extracted
44
- has_elements class: ChangedManagedFile
44
+ has_attributes :extracted
45
+ has_elements class: ChangedManagedFile
46
+ end
45
47
  end