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.
- checksums.yaml +4 -4
- data/.git_revision +1 -1
- data/NEWS +10 -0
- data/bin/machinery +1 -1
- data/lib/analyze_changed_config_files_diffs_task.rb +6 -6
- data/lib/autoyast.rb +2 -2
- data/lib/build_task.rb +10 -7
- data/lib/cli.rb +1005 -801
- data/lib/compare_task.rb +11 -7
- data/lib/comparison.rb +2 -2
- data/lib/config_base.rb +1 -1
- data/lib/config_task.rb +1 -1
- data/lib/containerize_task.rb +3 -3
- data/lib/containerized_app.rb +1 -1
- data/lib/copy_task.rb +1 -1
- data/lib/current_user.rb +1 -1
- data/lib/deploy_task.rb +6 -4
- data/lib/diff_widget.rb +67 -63
- data/lib/docker_system.rb +12 -8
- data/lib/dpkg_database.rb +1 -1
- data/lib/element_filter.rb +7 -4
- data/lib/exceptions.rb +23 -5
- data/lib/export_task.rb +1 -1
- data/lib/exporter.rb +1 -1
- data/lib/file_diff.rb +1 -1
- data/lib/file_scope.rb +1 -1
- data/lib/file_validator.rb +7 -4
- data/lib/filter.rb +97 -93
- data/lib/filter_option_parser.rb +2 -2
- data/lib/hint.rb +64 -59
- data/lib/html.rb +1 -1
- data/lib/inspect_task.rb +12 -12
- data/lib/inspector.rb +3 -3
- data/lib/json_validation_error_cleaner.rb +1 -1
- data/lib/json_validator.rb +4 -4
- data/lib/kiwi_config.rb +8 -4
- data/lib/list_task.rb +10 -9
- data/lib/local_system.rb +11 -5
- data/lib/logged_cheetah.rb +1 -1
- data/lib/man_task.rb +10 -6
- data/lib/managed_files_database.rb +1 -1
- data/lib/manifest.rb +5 -5
- data/lib/migration.rb +16 -10
- data/lib/mountpoints.rb +1 -1
- data/lib/move_task.rb +1 -1
- data/lib/remote_system.rb +7 -7
- data/lib/remove_task.rb +1 -1
- data/lib/renderer.rb +177 -172
- data/lib/rpm.rb +4 -4
- data/lib/rpm_database.rb +1 -1
- data/lib/scope.rb +2 -2
- data/lib/scope_file_access_archive.rb +1 -1
- data/lib/scope_file_access_flat.rb +1 -1
- data/lib/scope_file_store.rb +1 -1
- data/lib/serve_html_task.rb +6 -2
- data/lib/server.rb +19 -12
- data/lib/show_task.rb +10 -6
- data/lib/static_html.rb +1 -1
- data/lib/system.rb +10 -10
- data/lib/system_description.rb +14 -13
- data/lib/system_description_memory_store.rb +1 -1
- data/lib/system_description_store.rb +9 -9
- data/lib/tarball.rb +8 -2
- data/lib/upgrade_format_task.rb +11 -6
- data/lib/validate_task.rb +2 -2
- data/lib/version.rb +1 -1
- data/lib/workload_mapper.rb +2 -2
- data/lib/workload_mapper_dsl.rb +1 -1
- data/lib/zypper.rb +40 -17
- data/machinery-helper/machinery_helper.go +35 -16
- data/machinery-helper/version.go +1 -1
- data/man/generated/machinery.1.gz +0 -0
- data/manual/site/sitemap.xml +24 -24
- data/plugins/changed_config_files/changed_config_files_inspector.rb +59 -56
- data/plugins/changed_config_files/changed_config_files_model.rb +23 -21
- data/plugins/changed_config_files/changed_config_files_renderer.rb +56 -52
- data/plugins/changed_managed_files/changed_managed_files_inspector.rb +52 -50
- data/plugins/changed_managed_files/changed_managed_files_model.rb +23 -21
- data/plugins/changed_managed_files/changed_managed_files_renderer.rb +43 -39
- data/plugins/environment/environment_inspector.rb +25 -23
- data/plugins/environment/environment_model.rb +5 -3
- data/plugins/groups/groups_inspector.rb +30 -28
- data/plugins/groups/groups_model.rb +18 -17
- data/plugins/groups/groups_renderer.rb +29 -25
- data/plugins/os/os_inspector.rb +120 -118
- data/plugins/os/os_model.rb +139 -134
- data/plugins/os/os_renderer.rb +13 -9
- data/plugins/packages/packages_inspector.rb +99 -86
- data/plugins/packages/packages_model.rb +35 -34
- data/plugins/packages/packages_renderer.rb +47 -39
- data/plugins/patterns/patterns_inspector.rb +70 -68
- data/plugins/patterns/patterns_model.rb +19 -18
- data/plugins/patterns/patterns_renderer.rb +36 -32
- data/plugins/repositories/repositories_inspector.rb +162 -156
- data/plugins/repositories/repositories_model.rb +50 -49
- data/plugins/repositories/repositories_renderer.rb +48 -44
- data/plugins/repositories/schema/system-description-repositories.schema-v10.json +0 -1
- data/plugins/services/services_inspector.rb +187 -176
- data/plugins/services/services_model.rb +37 -36
- data/plugins/services/services_renderer.rb +28 -24
- data/plugins/unmanaged_files/unmanaged_files_inspector.rb +102 -99
- data/plugins/unmanaged_files/unmanaged_files_model.rb +64 -56
- data/plugins/unmanaged_files/unmanaged_files_renderer.rb +44 -40
- data/plugins/users/users_inspector.rb +67 -65
- data/plugins/users/users_model.rb +37 -36
- data/plugins/users/users_renderer.rb +31 -27
- data/schema/migrations/migrate1to2.rb +1 -1
- data/schema/migrations/migrate2to3.rb +1 -1
- data/schema/migrations/migrate3to4.rb +1 -1
- data/schema/migrations/migrate4to5.rb +1 -1
- data/schema/migrations/migrate5to6.rb +1 -1
- data/schema/migrations/migrate6to7.rb +1 -1
- data/schema/migrations/migrate7to8.rb +1 -1
- data/schema/migrations/migrate8to9.rb +1 -1
- data/schema/migrations/migrate9to10.rb +1 -1
- 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
|
-
|
19
|
-
|
18
|
+
module Machinery
|
19
|
+
class ChangedConfigFilesInspector < Machinery::Inspector
|
20
|
+
has_priority 80
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
35
|
+
def initialize(system, description)
|
36
|
+
@system = system
|
37
|
+
@description = description
|
38
|
+
end
|
38
39
|
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
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
|
-
|
60
|
-
|
61
|
-
|
60
|
+
scope = ChangedConfigFilesScope.new
|
61
|
+
file_store = @description.scope_file_store("changed_config_files")
|
62
|
+
scope.scope_file_store = file_store
|
62
63
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
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
|
-
|
74
|
-
|
75
|
+
scope.extracted = !!do_extract
|
76
|
+
scope += result.sort_by(&:name)
|
75
77
|
|
76
|
-
|
77
|
-
|
78
|
+
@description["changed_config_files"] = scope
|
79
|
+
end
|
78
80
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
19
|
-
|
18
|
+
module Machinery
|
19
|
+
class ConfigFile < Machinery::SystemFile
|
20
|
+
end
|
20
21
|
|
21
|
-
class ConfigFileList < Machinery::Array
|
22
|
-
|
22
|
+
class ConfigFileList < Machinery::Array
|
23
|
+
has_elements class: ConfigFile
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
41
|
-
|
40
|
+
class ChangedConfigFilesScope < Machinery::FileScope
|
41
|
+
include Machinery::Scope
|
42
|
+
include Machinery::ScopeFileAccessFlat
|
42
43
|
|
43
|
-
|
44
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
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
|
-
|
24
|
+
diffs_dir = description.scope_file_store("analyze/changed_config_files_diffs").path
|
23
25
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
33
|
-
|
34
|
-
|
34
|
+
list do
|
35
|
+
file_status = description["changed_config_files"].extracted
|
36
|
+
files = description["changed_config_files"]
|
35
37
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
59
|
-
|
60
|
-
|
60
|
+
def display_name
|
61
|
+
"Changed Configuration Files"
|
62
|
+
end
|
61
63
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
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
|
-
|
69
|
-
|
70
|
-
|
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
|
-
|
81
|
+
private
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
+
def render_diff_file(diffs_dir, name)
|
84
|
+
path = File.join(diffs_dir, name + ".diff")
|
83
85
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
|
-
|
19
|
-
|
18
|
+
module Machinery
|
19
|
+
class ChangedManagedFilesInspector < Machinery::Inspector
|
20
|
+
has_priority 90
|
20
21
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
27
|
+
def inspect(filter, options = {})
|
28
|
+
system.check_retrieve_files_dependencies if options[:extract_changed_managed_files]
|
30
29
|
|
31
|
-
|
32
|
-
file_store = @description.scope_file_store("changed_managed_files")
|
33
|
-
scope.scope_file_store = file_store
|
30
|
+
@system = system
|
34
31
|
|
35
|
-
|
32
|
+
scope = ChangedManagedFilesScope.new
|
33
|
+
file_store = @description.scope_file_store("changed_managed_files")
|
34
|
+
scope.scope_file_store = file_store
|
36
35
|
|
37
|
-
|
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
|
-
|
43
|
-
|
44
|
-
|
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
|
-
|
55
|
-
|
43
|
+
file_store.remove
|
44
|
+
if options[:extract_changed_managed_files]
|
45
|
+
file_store.create
|
56
46
|
|
57
|
-
|
58
|
-
|
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
|
-
|
61
|
-
|
55
|
+
scope.retrieve_files_from_system(@system, existing_files.map(&:name))
|
56
|
+
end
|
62
57
|
|
63
|
-
|
64
|
-
|
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
|
-
|
61
|
+
@description["changed_managed_files"] = scope
|
62
|
+
end
|
71
63
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
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
|
-
|
81
|
-
|
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
|
-
|
19
|
-
|
18
|
+
module Machinery
|
19
|
+
class ChangedManagedFile < Machinery::SystemFile
|
20
|
+
end
|
20
21
|
|
21
|
-
class ChangedManagedFileList < Machinery::Array
|
22
|
-
|
22
|
+
class ChangedManagedFileList < Machinery::Array
|
23
|
+
has_elements class: ChangedManagedFile
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
41
|
-
|
40
|
+
class ChangedManagedFilesScope < Machinery::FileScope
|
41
|
+
include Machinery::Scope
|
42
|
+
include Machinery::ScopeFileAccessFlat
|
42
43
|
|
43
|
-
|
44
|
-
|
44
|
+
has_attributes :extracted
|
45
|
+
has_elements class: ChangedManagedFile
|
46
|
+
end
|
45
47
|
end
|