machinery-tool 1.18.0 → 1.19.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/.git_revision +1 -1
  3. data/NEWS +17 -0
  4. data/bin/machinery +10 -2
  5. data/html/comparison.html.haml +1 -1
  6. data/html/index.html.haml +2 -2
  7. data/html/partials/{config_files.html.haml → changed_config_files.html.haml} +10 -10
  8. data/html/partials/compare/changed_config_files.html.haml +48 -0
  9. data/html/partials/compare/{config_file_list.html.haml → changed_config_files_list.html.haml} +0 -0
  10. data/html/partials/compare/unmanaged_file_list.html.haml +1 -1
  11. data/html/partials/compare/unmanaged_files.html.haml +2 -2
  12. data/html/partials/patterns.html.haml +5 -0
  13. data/html/upgrade.html.haml +49 -0
  14. data/lib/{analyze_config_file_diffs_task.rb → analyze_changed_config_files_diffs_task.rb} +8 -8
  15. data/lib/autoyast.rb +12 -13
  16. data/lib/build_task.rb +2 -2
  17. data/lib/cli.rb +39 -32
  18. data/lib/compare_task.rb +1 -1
  19. data/lib/config_base.rb +1 -1
  20. data/lib/deploy_task.rb +4 -4
  21. data/lib/docker_system.rb +1 -1
  22. data/lib/element_filter.rb +3 -3
  23. data/lib/export_task.rb +3 -3
  24. data/lib/file_validator.rb +8 -5
  25. data/lib/filter.rb +5 -5
  26. data/lib/filter_option_parser.rb +3 -3
  27. data/lib/hint.rb +9 -4
  28. data/lib/html.rb +3 -3
  29. data/lib/inspect_task.rb +3 -3
  30. data/lib/json_schema_monkey_patch.rb +2 -2
  31. data/lib/json_validation_error_cleaner.rb +1 -1
  32. data/lib/json_validator.rb +2 -2
  33. data/lib/kiwi_config.rb +39 -14
  34. data/lib/list_task.rb +1 -1
  35. data/lib/local_system.rb +4 -4
  36. data/lib/machinery.rb +1 -1
  37. data/lib/machinery_logger.rb +4 -4
  38. data/lib/manifest.rb +5 -5
  39. data/lib/migration.rb +4 -4
  40. data/lib/object.rb +6 -10
  41. data/lib/remove_task.rb +1 -1
  42. data/lib/renderer.rb +5 -5
  43. data/lib/scope_file_access_archive.rb +2 -2
  44. data/lib/scope_file_access_flat.rb +3 -3
  45. data/lib/scope_file_store.rb +3 -3
  46. data/lib/serve_html_task.rb +15 -2
  47. data/lib/server.rb +32 -12
  48. data/lib/system.rb +1 -1
  49. data/lib/system_description.rb +16 -14
  50. data/lib/system_description_store.rb +5 -6
  51. data/lib/ui.rb +1 -1
  52. data/lib/upgrade_format_task.rb +2 -2
  53. data/lib/version.rb +1 -1
  54. data/lib/workload_mapper.rb +11 -11
  55. data/lib/zypper.rb +1 -1
  56. data/machinery-helper/Rakefile +1 -1
  57. data/machinery-helper/version.go +1 -1
  58. data/man/generated/machinery.1.gz +0 -0
  59. data/manual/docs/machinery-analyze.1.md +3 -3
  60. data/manual/docs/machinery-compare.1.md +2 -2
  61. data/manual/docs/machinery-inspect-docker.1.md +1 -1
  62. data/manual/docs/machinery-inspect.1.md +4 -1
  63. data/manual/docs/machinery-show.1.md +2 -2
  64. data/manual/docs/machinery_main_general.1.md +1 -1
  65. data/manual/docs/machinery_main_scopes.1.md +8 -6
  66. data/manual/site/machinery-analyze.1/index.html +3 -3
  67. data/manual/site/machinery-compare.1/index.html +2 -2
  68. data/manual/site/machinery-inspect-docker.1/index.html +1 -1
  69. data/manual/site/machinery-inspect.1/index.html +3 -1
  70. data/manual/site/machinery-show.1/index.html +2 -2
  71. data/manual/site/machinery_main_general.1/index.html +1 -1
  72. data/manual/site/machinery_main_scopes.1/index.html +8 -6
  73. data/manual/site/mkdocs/search_index.json +17 -17
  74. data/manual/site/sitemap.xml +23 -23
  75. data/plugins/{config_files/config_files.yml → changed_config_files/changed_config_files.yml} +3 -3
  76. data/plugins/{config_files/config_files_inspector.rb → changed_config_files/changed_config_files_inspector.rb} +14 -10
  77. data/plugins/{config_files/config_files_model.rb → changed_config_files/changed_config_files_model.rb} +1 -1
  78. data/plugins/{config_files/config_files_renderer.rb → changed_config_files/changed_config_files_renderer.rb} +9 -9
  79. data/plugins/{config_files/schema/system-description-config-files.schema-v1.json → changed_config_files/schema/system-description-changed-config-files.schema-v1.json} +0 -0
  80. data/plugins/{config_files/schema/system-description-config-files.schema-v2.json → changed_config_files/schema/system-description-changed-config-files.schema-v2.json} +0 -0
  81. data/plugins/{config_files/schema/system-description-config-files.schema-v3.json → changed_config_files/schema/system-description-changed-config-files.schema-v3.json} +0 -0
  82. data/plugins/{config_files/schema/system-description-config-files.schema-v4.json → changed_config_files/schema/system-description-changed-config-files.schema-v4.json} +0 -0
  83. data/plugins/{config_files/schema/system-description-config-files.schema-v5.json → changed_config_files/schema/system-description-changed-config-files.schema-v5.json} +0 -0
  84. data/plugins/{config_files/schema/system-description-config-files.schema-v6.json → changed_config_files/schema/system-description-changed-config-files.schema-v6.json} +0 -0
  85. data/plugins/{config_files/schema/system-description-config-files.schema-v7.json → changed_config_files/schema/system-description-changed-config-files.schema-v7.json} +0 -0
  86. data/plugins/changed_config_files/schema/system-description-changed-config-files.schema-v8.json +160 -0
  87. data/plugins/changed_managed_files/changed_managed_files_inspector.rb +6 -2
  88. data/plugins/changed_managed_files/changed_managed_files_renderer.rb +1 -1
  89. data/plugins/changed_managed_files/schema/system-description-changed-managed-files.schema-v8.json +160 -0
  90. data/plugins/environment/schema/system-description-environment.schema-v8.json +17 -0
  91. data/plugins/groups/groups_inspector.rb +1 -1
  92. data/plugins/groups/groups_renderer.rb +1 -1
  93. data/plugins/groups/schema/system-description-groups.schema-v8.json +49 -0
  94. data/plugins/os/os_inspector.rb +6 -6
  95. data/plugins/os/os_renderer.rb +1 -1
  96. data/plugins/os/schema/system-description-os.schema-v8.json +21 -0
  97. data/plugins/packages/packages_inspector.rb +1 -1
  98. data/plugins/packages/schema/system-description-packages.schema-v8.json +115 -0
  99. data/plugins/patterns/patterns.yml +5 -3
  100. data/plugins/patterns/patterns_inspector.rb +4 -3
  101. data/plugins/patterns/patterns_renderer.rb +5 -1
  102. data/plugins/patterns/schema/system-description-patterns.schema-v8.json +58 -0
  103. data/plugins/repositories/repositories_inspector.rb +2 -1
  104. data/plugins/repositories/schema/system-description-repositories.schema-v8.json +165 -0
  105. data/plugins/services/schema/system-description-services.schema-v8.json +93 -0
  106. data/plugins/services/services.yml +1 -1
  107. data/plugins/services/services_inspector.rb +1 -1
  108. data/plugins/unmanaged_files/schema/system-description-unmanaged-files.schema-v8.json +124 -0
  109. data/plugins/unmanaged_files/unmanaged_files_inspector.rb +9 -4
  110. data/plugins/unmanaged_files/unmanaged_files_model.rb +12 -5
  111. data/plugins/unmanaged_files/unmanaged_files_renderer.rb +1 -1
  112. data/plugins/users/schema/system-description-users.schema-v8.json +86 -0
  113. data/plugins/users/users_inspector.rb +7 -7
  114. data/schema/migrations/migrate1to2.rb +4 -4
  115. data/schema/migrations/migrate2to3.rb +1 -1
  116. data/schema/migrations/migrate3to4.rb +9 -9
  117. data/schema/migrations/migrate7to8.rb +47 -0
  118. data/schema/system-description-global.schema-v8.json +43 -0
  119. data/workload_mapper/rails/setup/setup.rb.erb +1 -1
  120. data/workload_mapper/wordpress/setup/setup.rb.erb +1 -1
  121. metadata +31 -17
  122. data/html/partials/compare/config_files.html.haml +0 -48
@@ -0,0 +1,93 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+
4
+ "type": "object",
5
+ "required": [
6
+ "_elements"
7
+ ],
8
+ "oneOf": [
9
+ {
10
+ "properties": {
11
+ "_attributes": {
12
+ "type": "object",
13
+ "required": [
14
+ "init_system"
15
+ ],
16
+ "properties": {
17
+ "init_system": {
18
+ "not": {
19
+ "enum": [
20
+ "upstart"
21
+ ]
22
+ },
23
+ "type": "string",
24
+ "minLength": 1
25
+ }
26
+ }
27
+ },
28
+ "_elements": {
29
+ "type": "array",
30
+ "items": {
31
+ "type": "object",
32
+ "required": [
33
+ "name",
34
+ "state"
35
+ ],
36
+ "properties": {
37
+ "name": {
38
+ "type": "string",
39
+ "minLength": 1
40
+ },
41
+ "state": {
42
+ "type": "string",
43
+ "minLength": 1
44
+ }
45
+ }
46
+ }
47
+ }
48
+ }
49
+ },
50
+ {
51
+ "properties": {
52
+ "_attributes": {
53
+ "type": "object",
54
+ "required": [
55
+ "init_system"
56
+ ],
57
+ "properties": {
58
+ "init_system": {
59
+ "enum": [
60
+ "upstart"
61
+ ]
62
+ }
63
+ }
64
+ },
65
+ "_elements": {
66
+ "type": "array",
67
+ "items": {
68
+ "type": "object",
69
+ "required": [
70
+ "name",
71
+ "state",
72
+ "legacy_sysv"
73
+ ],
74
+ "properties": {
75
+ "name": {
76
+ "type": "string",
77
+ "minLength": 1
78
+ },
79
+ "state": {
80
+ "type": "string",
81
+ "minLength": 1
82
+ },
83
+ "legacy_sysv": {
84
+ "type": "boolean"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ ]
92
+ }
93
+
@@ -7,4 +7,4 @@
7
7
  The scope determines which services are configured to be started in which
8
8
  runlevel. It uses the `chkconfig` command to obtain that information.
9
9
  The xinetd services that are also displayed by `chkconfig` are switched
10
- on/off by editing config files and are ignored in this context.
10
+ on/off by editing configuration files and are ignored in this context.
@@ -45,7 +45,7 @@ class ServicesInspector < Inspector
45
45
  end
46
46
 
47
47
  def summary
48
- "Found #{@description.services.length} services."
48
+ "Found #{Machinery.pluralize(@description.services.length, "%d service")}."
49
49
  end
50
50
 
51
51
  private
@@ -0,0 +1,124 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+
4
+ "type": "object",
5
+ "required": [
6
+ "_elements"
7
+ ],
8
+ "properties": {
9
+ "_attributes": {
10
+ "type": "object",
11
+ "required": [
12
+ "extracted",
13
+ "has_metadata"
14
+ ],
15
+ "properties": {
16
+ "extracted": {
17
+ "type": "boolean"
18
+ },
19
+ "has_metadata": {
20
+ "type": "boolean"
21
+ }
22
+ }
23
+ },
24
+ "_elements": {
25
+ "type": "array",
26
+ "items": {
27
+ "anyOf": [
28
+ {
29
+ "$ref": "#/definitions/file"
30
+ },
31
+ {
32
+ "$ref": "#/definitions/file_remote_dir"
33
+ }
34
+ ]
35
+ }
36
+ }
37
+ },
38
+ "definitions": {
39
+ "file_common": {
40
+ "type": "object",
41
+ "required": ["name", "type"],
42
+ "properties": {
43
+ "name": {
44
+ "type": "string"
45
+ }
46
+ }
47
+ },
48
+ "file": {
49
+ "allOf": [
50
+ { "$ref": "#/definitions/file_common" },
51
+ {
52
+ "properties": {
53
+ "user": {
54
+ "type": "string",
55
+ "minLength": 1
56
+ },
57
+ "group": {
58
+ "type": "string",
59
+ "minLength": 1
60
+ }
61
+ },
62
+ "oneOf": [
63
+ { "$ref": "#/definitions/file_file" },
64
+ { "$ref": "#/definitions/file_dir" },
65
+ { "$ref": "#/definitions/file_link" }
66
+ ]
67
+ }
68
+ ]
69
+ },
70
+ "file_file": {
71
+ "properties": {
72
+ "type": {
73
+ "enum": ["file"]
74
+ },
75
+ "size": {
76
+ "type": "integer",
77
+ "minimum": 0
78
+ },
79
+ "mode": {
80
+ "type": "string",
81
+ "pattern": "^[0-7]{3,4}$"
82
+ }
83
+ }
84
+ },
85
+ "file_dir": {
86
+ "properties": {
87
+ "type": {
88
+ "enum": ["dir"]
89
+ },
90
+ "size": {
91
+ "type": "integer",
92
+ "minimum": 0
93
+ },
94
+ "mode": {
95
+ "type": "string",
96
+ "pattern": "^[0-4]?[0-7]{3}$"
97
+ },
98
+ "files": {
99
+ "type": "integer",
100
+ "minimum": 0
101
+ }
102
+ }
103
+ },
104
+ "file_link": {
105
+ "properties": {
106
+ "type": {
107
+ "enum": ["link"]
108
+ }
109
+ }
110
+ },
111
+ "file_remote_dir": {
112
+ "allOf": [
113
+ { "$ref": "#/definitions/file_common" },
114
+ {
115
+ "properties": {
116
+ "type": {
117
+ "enum": ["remote_dir"]
118
+ }
119
+ }
120
+ }
121
+ ]
122
+ }
123
+ }
124
+ }
@@ -72,7 +72,7 @@ class UnmanagedFilesInspector < Inspector
72
72
  def run_helper_inspection(helper, filter, file_store_tmp, file_store_final, scope, options)
73
73
  begin
74
74
  helper.inject_helper
75
- if !helper.has_compatible_version?
75
+ unless helper.has_compatible_version?
76
76
  raise Machinery::Errors::UnsupportedHelperVersion.new(
77
77
  "Error: machinery-helper is not compatible with this Machinery version." \
78
78
  "\nTry to reinstall the package or gem to fix the issue."
@@ -120,14 +120,19 @@ class UnmanagedFilesInspector < Inspector
120
120
 
121
121
  def summary
122
122
  "#{@description.unmanaged_files.extracted ? "Extracted" : "Found"} " +
123
- "#{@description.unmanaged_files.count} unmanaged files and trees."
123
+ Machinery.pluralize(
124
+ @description.unmanaged_files.count,
125
+ "%d unmanaged file or tree.",
126
+ "%d unmanaged files and/or trees."
127
+ )
124
128
  end
125
129
 
126
130
  private
127
131
 
128
132
  def show_extraction_progress(count)
129
- progress = Machinery::pluralize(
130
- count, " -> Extracted %d file or tree", " -> Extracted %d files and trees",
133
+ progress = Machinery.pluralize(
134
+ count, " -> Extracted %d unmanaged file or tree...",
135
+ " -> Extracted %d unmanaged files and/or trees..."
131
136
  )
132
137
  Machinery::Ui.progress(progress)
133
138
  end
@@ -40,14 +40,14 @@ class UnmanagedFilesScope < FileScope
40
40
  both = []
41
41
  only_self = []
42
42
  elements.each do |element|
43
- if other_hash.has_key?(element.name) && files_match(element, other_hash[element.name])
43
+ if other_hash.key?(element.name) && files_match(element, other_hash[element.name])
44
44
  both << element
45
45
  else
46
46
  only_self << element
47
47
  end
48
48
  end
49
49
  only_other = other.elements.reject do |element|
50
- self_hash.has_key?(element.name) && files_match(element, self_hash[element.name])
50
+ self_hash.key?(element.name) && files_match(element, self_hash[element.name])
51
51
  end
52
52
  changed = Machinery::Scope.extract_changed_elements(only_self, only_other, :name)
53
53
 
@@ -58,12 +58,19 @@ class UnmanagedFilesScope < FileScope
58
58
  only_other_attributes = other.attributes
59
59
  end
60
60
 
61
- [
61
+ comparison = [
62
62
  self.class.new(only_self, only_self_attributes || {}),
63
63
  self.class.new(only_other, only_other_attributes || {}),
64
- changed,
65
- self.class.new(both, common_attributes || {})
64
+ changed
66
65
  ].map { |e| e.empty? ? nil : e }
66
+
67
+ common = if both.empty? && common_attributes && common_attributes.empty?
68
+ nil
69
+ else
70
+ self.class.new(both, common_attributes || {})
71
+ end
72
+
73
+ comparison.push(common)
67
74
  end
68
75
 
69
76
  private
@@ -46,7 +46,7 @@ class UnmanagedFilesRenderer < Renderer
46
46
  end
47
47
 
48
48
  def display_name
49
- "Unmanaged files"
49
+ "Unmanaged Files"
50
50
  end
51
51
 
52
52
  def compare_content_changed(changed_elements)
@@ -0,0 +1,86 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-04/schema#",
3
+
4
+ "type": "object",
5
+ "required": [
6
+ "_elements"
7
+ ],
8
+ "properties": {
9
+ "_attributes": {
10
+ "type": "object"
11
+ },
12
+ "_elements": {
13
+ "type": "array",
14
+ "items": {
15
+ "type": "object",
16
+ "required": [
17
+ "name",
18
+ "password",
19
+ "uid",
20
+ "gid",
21
+ "comment",
22
+ "home",
23
+ "shell"
24
+ ],
25
+ "properties": {
26
+ "name": {
27
+ "type": "string",
28
+ "minLength": 1
29
+ },
30
+ "password": {
31
+ "type": "string"
32
+ },
33
+ "uid": {
34
+ "type": [
35
+ "integer",
36
+ "null"
37
+ ],
38
+ "minimum": 0
39
+ },
40
+ "gid": {
41
+ "type": [
42
+ "integer",
43
+ "null"
44
+ ],
45
+ "minimum": 0
46
+ },
47
+ "comment": {
48
+ "type": "string"
49
+ },
50
+ "home": {
51
+ "type": "string"
52
+ },
53
+ "shell": {
54
+ "type": "string"
55
+ },
56
+ "encrypted_password": {
57
+ "type": "string"
58
+ },
59
+ "last_changed_date": {
60
+ "type": "integer"
61
+ },
62
+ "min_days": {
63
+ "type": "integer",
64
+ "minimum": 0
65
+ },
66
+ "max_days": {
67
+ "type": "integer",
68
+ "minimum": 0
69
+ },
70
+ "warn_days": {
71
+ "type": "integer",
72
+ "minimum": 0
73
+ },
74
+ "disable_days": {
75
+ "type": "integer",
76
+ "minimum": 0
77
+ },
78
+ "disabled_date": {
79
+ "type": "integer"
80
+ }
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+
@@ -33,7 +33,7 @@ class UsersInspector < Inspector
33
33
  end
34
34
 
35
35
  def summary
36
- "Found #{@description.users.size} users."
36
+ "Found #{Machinery.pluralize(@description.users.size, "%d user")}."
37
37
  end
38
38
 
39
39
  private
@@ -83,12 +83,12 @@ class UsersInspector < Inspector
83
83
  result = {
84
84
  encrypted_password: passwd
85
85
  }
86
- result[:last_changed_date] = changed.to_i if !changed.empty?
87
- result[:min_days] = min.to_i if !min.empty?
88
- result[:max_days] = max.to_i if !max.empty?
89
- result[:warn_days] = warn.to_i if !warn.empty?
90
- result[:disable_days] = inactive.to_i if !inactive.empty?
91
- result[:disabled_date] = expire.to_i if !expire.empty?
86
+ result[:last_changed_date] = changed.to_i unless changed.empty?
87
+ result[:min_days] = min.to_i unless min.empty?
88
+ result[:max_days] = max.to_i unless max.empty?
89
+ result[:warn_days] = warn.to_i unless warn.empty?
90
+ result[:disable_days] = inactive.to_i unless inactive.empty?
91
+ result[:disabled_date] = expire.to_i unless expire.empty?
92
92
 
93
93
  result
94
94
  else
@@ -34,10 +34,10 @@ class Migrate1To2 < Migration
34
34
  "changed_managed_files",
35
35
  "unmanaged_files"
36
36
  ].each do |scope|
37
- next if !@hash.has_key?(scope)
37
+ next unless @hash.key?(scope)
38
38
 
39
39
  files = @hash[scope]
40
- is_extracted = Dir.exists?(File.join(@path, scope))
40
+ is_extracted = Dir.exist?(File.join(@path, scope))
41
41
 
42
42
  @hash[scope] = {
43
43
  "extracted" => is_extracted,
@@ -45,9 +45,9 @@ class Migrate1To2 < Migration
45
45
  }
46
46
  end
47
47
 
48
- if @hash.has_key?("groups")
48
+ if @hash.key?("groups")
49
49
  @hash["groups"].each do |element|
50
- if !element["gid"]
50
+ unless element["gid"]
51
51
  element["gid"] = nil
52
52
  end
53
53
  end