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,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
|
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
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
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
|
-
|
54
|
+
private
|
55
55
|
|
56
|
-
|
57
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
module Machinery
|
19
|
+
class Ui
|
20
|
+
class PackagesRenderer < Machinery::Ui::Renderer
|
21
|
+
def display_name
|
22
|
+
"Packages"
|
23
|
+
end
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
+
def content(description)
|
26
|
+
return unless description.packages
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
if description.packages.elements.empty?
|
29
|
+
puts "There are no packages."
|
30
|
+
end
|
29
31
|
|
30
|
-
|
32
|
+
na_note("package vendor") if description.packages.any? { |a| a[:vendor] == "" }
|
31
33
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
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
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
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
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
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
|
-
|
26
|
-
|
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
|
-
|
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 = "
|
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
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
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
|
-
|
56
|
+
private
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
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
|
-
|
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
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
74
|
+
if pattern_list.empty?
|
75
|
+
@description.patterns = PatternsScope.new
|
76
|
+
return
|
77
|
+
end
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
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
|
-
|
87
|
-
|
88
|
-
|
87
|
+
@description.patterns = PatternsScope.new(patterns)
|
88
|
+
@description.patterns.attributes["patterns_system"] = "zypper"
|
89
|
+
end
|
89
90
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
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
|
-
|
102
|
-
|
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
|
20
|
-
|
21
|
-
|
22
|
-
class PatternsScope < Machinery::Array
|
23
|
-
include Machinery::Scope
|
22
|
+
class PatternsScope < Machinery::Array
|
23
|
+
include Machinery::Scope
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
has_attributes :patterns_system
|
26
|
+
has_elements class: Pattern
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
18
|
+
module Machinery
|
19
|
+
class Ui
|
20
|
+
class PatternsRenderer < Machinery::Ui::Renderer
|
21
|
+
def content(description)
|
22
|
+
return unless description.patterns
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
if description.patterns.empty?
|
25
|
+
puts "There are no patterns or tasks."
|
26
|
+
end
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
if description.patterns.patterns_system == "tasksel"
|
29
|
+
puts "Note: Tasks on Debian-like systems are treated as patterns."
|
30
|
+
end
|
29
31
|
|
30
|
-
|
31
|
-
|
32
|
+
puts "Pattern Manager: #{description.patterns.patterns_system}" unless
|
33
|
+
description.patterns.empty?
|
32
34
|
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
42
|
+
def display_name
|
43
|
+
"Patterns"
|
44
|
+
end
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
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
|
-
|
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
|