machinery-tool 1.20.0 → 1.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/.git_revision +1 -1
  3. data/NEWS +12 -0
  4. data/html/assets/bootstrap-modal.js +338 -0
  5. data/html/assets/compare/machinery.js +15 -0
  6. data/html/assets/fonts/glyphicons-halflings-regular.ttf +0 -0
  7. data/html/assets/fonts/glyphicons-halflings-regular.woff +0 -0
  8. data/html/assets/machinery-base.css +5 -2
  9. data/html/assets/machinery-base.js +16 -1
  10. data/html/assets/machinery.css +41 -0
  11. data/html/assets/show/machinery.js +18 -0
  12. data/html/comparison.html.haml +25 -26
  13. data/html/homepage.html.haml +24 -0
  14. data/html/index.html.haml +35 -30
  15. data/html/partials/{landing_page/alert.html.haml → alert.html.haml} +0 -0
  16. data/html/partials/compare/changed_config_files.html.haml +1 -1
  17. data/html/partials/compare/changed_managed_files.html.haml +1 -1
  18. data/html/partials/compare/groups.html.haml +1 -1
  19. data/html/partials/compare/os.html.haml +1 -1
  20. data/html/partials/compare/packages.html.haml +1 -1
  21. data/html/partials/compare/pattern_list.html.haml +3 -0
  22. data/html/partials/compare/patterns.html.haml +1 -2
  23. data/html/partials/compare/repositories.html.haml +1 -1
  24. data/html/partials/compare/services.html.haml +1 -1
  25. data/html/partials/compare/unmanaged_file_list.html.haml +12 -4
  26. data/html/partials/compare/unmanaged_files.html.haml +1 -1
  27. data/html/partials/compare/users.html.haml +1 -1
  28. data/html/partials/description_selector.html.haml +57 -0
  29. data/html/partials/nav_bar.html.haml +34 -0
  30. data/html/partials/patterns.html.haml +4 -1
  31. data/html/partials/unmanaged_files.html.haml +11 -3
  32. data/lib/config_task.rb +8 -2
  33. data/lib/exceptions.rb +0 -1
  34. data/lib/server.rb +19 -2
  35. data/lib/system_description.rb +1 -1
  36. data/lib/version.rb +1 -1
  37. data/lib/zypper.rb +1 -1
  38. data/machinery-helper/machinery_helper.go +12 -4
  39. data/machinery-helper/machinery_helper_test.go +5 -1
  40. data/machinery-helper/version.go +1 -1
  41. data/man/generated/machinery.1.gz +0 -0
  42. data/manual/site/sitemap.xml +23 -23
  43. data/plugins/changed_config_files/schema/system-description-changed-config-files.schema-v10.json +160 -0
  44. data/plugins/changed_managed_files/schema/system-description-changed-managed-files.schema-v10.json +160 -0
  45. data/plugins/environment/schema/system-description-environment.schema-v10.json +17 -0
  46. data/plugins/groups/schema/system-description-groups.schema-v10.json +49 -0
  47. data/plugins/os/schema/system-description-os.schema-v10.json +21 -0
  48. data/plugins/packages/schema/system-description-packages.schema-v10.json +115 -0
  49. data/plugins/patterns/patterns_inspector.rb +2 -0
  50. data/plugins/patterns/patterns_model.rb +1 -0
  51. data/plugins/patterns/patterns_renderer.rb +4 -1
  52. data/plugins/patterns/schema/system-description-patterns.schema-v10.json +69 -0
  53. data/plugins/repositories/schema/system-description-repositories.schema-v10.json +165 -0
  54. data/plugins/services/schema/system-description-services.schema-v10.json +93 -0
  55. data/plugins/services/services_inspector.rb +40 -9
  56. data/plugins/unmanaged_files/schema/system-description-unmanaged-files.schema-v10.json +153 -0
  57. data/plugins/unmanaged_files/unmanaged_files_model.rb +8 -0
  58. data/plugins/unmanaged_files/unmanaged_files_renderer.rb +8 -2
  59. data/plugins/users/schema/system-description-users.schema-v10.json +86 -0
  60. data/schema/migrations/migrate9to10.rb +55 -0
  61. data/schema/system-description-global.schema-v10.json +43 -0
  62. metadata +23 -5
  63. data/html/landing_page.html.haml +0 -62
@@ -6,7 +6,7 @@
6
6
  :scope => "patterns",
7
7
  :title => "Patterns",
8
8
  :count => "#{patterns.length} #{Machinery.pluralize(patterns.length, "pattern")}"
9
- - if @description.packages && @description.packages.package_system == "dpkg"
9
+ - if @description.patterns.patterns_system == "dpkg"
10
10
  .row
11
11
  .col-xs-1
12
12
  .col-xs-11
@@ -14,6 +14,9 @@
14
14
  .row.scope_content.collapse.in
15
15
  .col-xs-1
16
16
  .col-xs-11
17
+ %p
18
+ %strong Patterns Manager:
19
+ = @description.patterns.patterns_system
17
20
  - if patterns.length == 0
18
21
  There are no patterns.
19
22
  - if patterns.length > 0
@@ -20,12 +20,16 @@
20
20
  %tr
21
21
  %th Name
22
22
  %th.medium Type
23
- - if unmanaged_files.has_metadata
23
+ - if unmanaged_files.contains_metadata?
24
24
  %th.medium Mode
25
25
  %th.medium User
26
26
  %th.medium Group
27
27
  %th.medium Size
28
- %th.medium Files in dir.
28
+ - if unmanaged_files.has_subdir_counts?
29
+ %th.medium Subdirectories
30
+ %th.medium Files in Directory
31
+ - else
32
+ %th.medium File Objects
29
33
  %tbody
30
34
  - unmanaged_files.each do |file|
31
35
  %tr
@@ -37,9 +41,13 @@
37
41
  %span
38
42
  = file.name
39
43
  %td= file.type
40
- - if unmanaged_files.has_metadata
44
+ - if unmanaged_files.contains_metadata?
41
45
  %td= file.mode
42
46
  %td= file.user
43
47
  %td= file.group
44
48
  %td= number_to_human_size(file.size)
49
+ - if unmanaged_files.has_subdir_counts?
50
+ %td= file.dirs
45
51
  %td= file.files
52
+ - else
53
+ %td= file.file_objects
data/lib/config_task.rb CHANGED
@@ -24,9 +24,15 @@ class ConfigTask
24
24
  if !key
25
25
  # show all config entries
26
26
  max_length = @config.entries.keys.map(&:length).max
27
- @config.each do |key, value|
27
+ @config.each do |config_key, config_value|
28
28
  Machinery::Ui.puts (
29
- "%-#{max_length}s %s %s %s" % [key, "=", value[:value], "(#{value[:description]})"]
29
+ format(
30
+ "%-#{max_length}s %s %s %s",
31
+ config_key,
32
+ "=",
33
+ config_value[:value],
34
+ "(#{config_value[:description]})"
35
+ )
30
36
  )
31
37
  end
32
38
  elsif !value_string
data/lib/exceptions.rb CHANGED
@@ -65,7 +65,6 @@ module Machinery
65
65
  end
66
66
 
67
67
  def to_s
68
- meta = @description[@scopes.first].meta
69
68
  hostname = @scopes.map do |s|
70
69
  @description[s].meta.hostname if @description[s].meta
71
70
  end.compact.first || "<HOSTNAME>"
data/lib/server.rb CHANGED
@@ -102,6 +102,11 @@ class Server < Sinatra::Base
102
102
  "<h3>In both descriptions:</h3>"
103
103
  end
104
104
 
105
+ def offset_class(first_col)
106
+ return "" if first_col
107
+ "col-md-offset-6"
108
+ end
109
+
105
110
  def changed
106
111
  "<h3>In both with different attributes:</h3>"
107
112
  end
@@ -251,7 +256,7 @@ class Server < Sinatra::Base
251
256
  content
252
257
  end
253
258
 
254
- get "/" do
259
+ def all_descriptions
255
260
  check_session_for_error
256
261
  descriptions = settings.system_description_store.list
257
262
  @all_descriptions = Hash.new
@@ -283,11 +288,21 @@ class Server < Sinatra::Base
283
288
  @errors.push(e)
284
289
  end
285
290
  end
291
+ end
292
+
293
+ get "/" do
294
+ all_descriptions
295
+
296
+ haml File.read(File.join(Machinery::ROOT, "html/homepage.html.haml"))
297
+ end
286
298
 
287
- haml File.read(File.join(Machinery::ROOT, "html/landing_page.html.haml"))
299
+ get "/fonts/:font" do
300
+ File.read(File.join(Machinery::ROOT, "html/assets/fonts/#{params[:font]}"))
288
301
  end
289
302
 
290
303
  get "/compare/:a/:b" do
304
+ all_descriptions
305
+
291
306
  @description_a = SystemDescription.load(params[:a], settings.system_description_store)
292
307
  @description_b = SystemDescription.load(params[:b], settings.system_description_store)
293
308
 
@@ -330,6 +345,8 @@ class Server < Sinatra::Base
330
345
  end
331
346
 
332
347
  get "/:id" do
348
+ all_descriptions
349
+
333
350
  begin
334
351
  @description = SystemDescription.load(params[:id], settings.system_description_store)
335
352
  rescue Machinery::Errors::SystemDescriptionNotFound => e
@@ -26,7 +26,7 @@
26
26
  # The sub directories storing the data for specific scopes are handled by the
27
27
  # ScopeFileStore class.
28
28
  class SystemDescription < Machinery::Object
29
- CURRENT_FORMAT_VERSION = 9
29
+ CURRENT_FORMAT_VERSION = 10
30
30
  EXTRACTABLE_SCOPES = [
31
31
  "changed_managed_files",
32
32
  "changed_config_files",
data/lib/version.rb CHANGED
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Machinery
19
19
 
20
- VERSION = "1.20.0"
20
+ VERSION = "1.21.0"
21
21
 
22
22
  end
data/lib/zypper.rb CHANGED
@@ -94,7 +94,7 @@ class Zypper
94
94
  cmd += args
95
95
 
96
96
  with_env "ZYPP_CONF" => @zypp_config do
97
- LoggedCheetah.run *cmd
97
+ LoggedCheetah.run(*cmd)
98
98
  end
99
99
  end
100
100
  end
@@ -43,6 +43,8 @@ type UnmanagedFile struct {
43
43
  Mode string `json:"mode,omitempty"`
44
44
  Files *int `json:"files,omitempty"`
45
45
  FilesValue int `json:"-"`
46
+ Dirs *int `json:"dirs,omitempty"`
47
+ DirsValue int `json:"-"`
46
48
  Size *int64 `json:"size,omitempty"`
47
49
  SizeValue int64 `json:"-"`
48
50
  }
@@ -287,17 +289,21 @@ func amendMode(entry *UnmanagedFile, perm os.FileMode) {
287
289
  }
288
290
  }
289
291
 
290
- func dirInfo(path string) (size int64, fileCount int) {
292
+ func dirInfo(path string) (size int64, fileCount int, dirCount int) {
291
293
  files, _ := readDir(path)
292
294
 
293
295
  size = int64(0)
294
296
  fileCount = len(files)
297
+ dirCount = 0
295
298
  for _, f := range files {
296
299
  if f.IsDir() {
300
+ dirCount++
301
+ fileCount--
297
302
  if _, ok := IgnoreList[path + f.Name()]; !ok {
298
- subSize, subCount := dirInfo(path + f.Name() + "/")
303
+ subSize, subFiles, subDirs := dirInfo(path + f.Name() + "/")
299
304
  size += subSize
300
- fileCount += subCount
305
+ fileCount += subFiles
306
+ dirCount += subDirs
301
307
  }
302
308
  } else if f.Mode()&os.ModeSymlink != os.ModeSymlink {
303
309
  size += f.Size()
@@ -312,11 +318,13 @@ func amendSize(entry *UnmanagedFile, size int64) {
312
318
  entry.SizeValue = size
313
319
  entry.Size = &entry.SizeValue
314
320
  } else if entry.Type == "dir" {
315
- size, files := dirInfo(entry.Name)
321
+ size, files, dirs := dirInfo(entry.Name)
316
322
  entry.SizeValue = size
317
323
  entry.Size = &entry.SizeValue
318
324
  entry.FilesValue = files
319
325
  entry.Files = &entry.FilesValue
326
+ entry.DirsValue = dirs
327
+ entry.Dirs = &entry.DirsValue
320
328
  }
321
329
  }
322
330
 
@@ -287,8 +287,12 @@ func TestAmendSize(t *testing.T) {
287
287
  if *entry.Size != want {
288
288
  t.Errorf("entry.Size = '%v', want '%v'", *entry.Size, want)
289
289
  }
290
- wantFiles := 6
290
+ wantFiles := 5
291
291
  if *entry.Files != wantFiles {
292
292
  t.Errorf("entry.Files = '%v', want '%v'", *entry.Files, wantFiles)
293
293
  }
294
+ wantDirs := 1
295
+ if *entry.Dirs != wantDirs {
296
+ t.Errorf("entry.Dirs = '%v', want '%v'", *entry.Dirs, wantDirs)
297
+ }
294
298
  }
@@ -2,4 +2,4 @@
2
2
 
3
3
  package main
4
4
 
5
- const VERSION = "d0bee698f4e775076d7d4f619d68bb8e347444c5"
5
+ const VERSION = "cf6d038ddefdf0d539b132c206336e141c39b418"
Binary file
@@ -4,7 +4,7 @@
4
4
 
5
5
  <url>
6
6
  <loc>None/docs/</loc>
7
- <lastmod>2016-04-22</lastmod>
7
+ <lastmod>2016-06-21</lastmod>
8
8
  <changefreq>daily</changefreq>
9
9
  </url>
10
10
 
@@ -13,25 +13,25 @@
13
13
 
14
14
  <url>
15
15
  <loc>None/machinery_main_general.1/</loc>
16
- <lastmod>2016-04-22</lastmod>
16
+ <lastmod>2016-06-21</lastmod>
17
17
  <changefreq>daily</changefreq>
18
18
  </url>
19
19
 
20
20
  <url>
21
21
  <loc>None/machinery_main_scopes.1/</loc>
22
- <lastmod>2016-04-22</lastmod>
22
+ <lastmod>2016-06-21</lastmod>
23
23
  <changefreq>daily</changefreq>
24
24
  </url>
25
25
 
26
26
  <url>
27
27
  <loc>None/machinery_main_usecases.1/</loc>
28
- <lastmod>2016-04-22</lastmod>
28
+ <lastmod>2016-06-21</lastmod>
29
29
  <changefreq>daily</changefreq>
30
30
  </url>
31
31
 
32
32
  <url>
33
33
  <loc>None/machinery_security_implications.1/</loc>
34
- <lastmod>2016-04-22</lastmod>
34
+ <lastmod>2016-06-21</lastmod>
35
35
  <changefreq>daily</changefreq>
36
36
  </url>
37
37
 
@@ -41,109 +41,109 @@
41
41
 
42
42
  <url>
43
43
  <loc>None/machinery-analyze.1/</loc>
44
- <lastmod>2016-04-22</lastmod>
44
+ <lastmod>2016-06-21</lastmod>
45
45
  <changefreq>daily</changefreq>
46
46
  </url>
47
47
 
48
48
  <url>
49
49
  <loc>None/machinery-build.1/</loc>
50
- <lastmod>2016-04-22</lastmod>
50
+ <lastmod>2016-06-21</lastmod>
51
51
  <changefreq>daily</changefreq>
52
52
  </url>
53
53
 
54
54
  <url>
55
55
  <loc>None/machinery-compare.1/</loc>
56
- <lastmod>2016-04-22</lastmod>
56
+ <lastmod>2016-06-21</lastmod>
57
57
  <changefreq>daily</changefreq>
58
58
  </url>
59
59
 
60
60
  <url>
61
61
  <loc>None/machinery-config.1/</loc>
62
- <lastmod>2016-04-22</lastmod>
62
+ <lastmod>2016-06-21</lastmod>
63
63
  <changefreq>daily</changefreq>
64
64
  </url>
65
65
 
66
66
  <url>
67
67
  <loc>None/machinery-copy.1/</loc>
68
- <lastmod>2016-04-22</lastmod>
68
+ <lastmod>2016-06-21</lastmod>
69
69
  <changefreq>daily</changefreq>
70
70
  </url>
71
71
 
72
72
  <url>
73
73
  <loc>None/machinery-deploy.1/</loc>
74
- <lastmod>2016-04-22</lastmod>
74
+ <lastmod>2016-06-21</lastmod>
75
75
  <changefreq>daily</changefreq>
76
76
  </url>
77
77
 
78
78
  <url>
79
79
  <loc>None/machinery-export-autoyast.1/</loc>
80
- <lastmod>2016-04-22</lastmod>
80
+ <lastmod>2016-06-21</lastmod>
81
81
  <changefreq>daily</changefreq>
82
82
  </url>
83
83
 
84
84
  <url>
85
85
  <loc>None/machinery-export-kiwi.1/</loc>
86
- <lastmod>2016-04-22</lastmod>
86
+ <lastmod>2016-06-21</lastmod>
87
87
  <changefreq>daily</changefreq>
88
88
  </url>
89
89
 
90
90
  <url>
91
91
  <loc>None/machinery-inspect.1/</loc>
92
- <lastmod>2016-04-22</lastmod>
92
+ <lastmod>2016-06-21</lastmod>
93
93
  <changefreq>daily</changefreq>
94
94
  </url>
95
95
 
96
96
  <url>
97
97
  <loc>None/machinery-inspect-docker.1/</loc>
98
- <lastmod>2016-04-22</lastmod>
98
+ <lastmod>2016-06-21</lastmod>
99
99
  <changefreq>daily</changefreq>
100
100
  </url>
101
101
 
102
102
  <url>
103
103
  <loc>None/machinery-list.1/</loc>
104
- <lastmod>2016-04-22</lastmod>
104
+ <lastmod>2016-06-21</lastmod>
105
105
  <changefreq>daily</changefreq>
106
106
  </url>
107
107
 
108
108
  <url>
109
109
  <loc>None/machinery-man.1/</loc>
110
- <lastmod>2016-04-22</lastmod>
110
+ <lastmod>2016-06-21</lastmod>
111
111
  <changefreq>daily</changefreq>
112
112
  </url>
113
113
 
114
114
  <url>
115
115
  <loc>None/machinery-move.1/</loc>
116
- <lastmod>2016-04-22</lastmod>
116
+ <lastmod>2016-06-21</lastmod>
117
117
  <changefreq>daily</changefreq>
118
118
  </url>
119
119
 
120
120
  <url>
121
121
  <loc>None/machinery-remove.1/</loc>
122
- <lastmod>2016-04-22</lastmod>
122
+ <lastmod>2016-06-21</lastmod>
123
123
  <changefreq>daily</changefreq>
124
124
  </url>
125
125
 
126
126
  <url>
127
127
  <loc>None/machinery-serve.1/</loc>
128
- <lastmod>2016-04-22</lastmod>
128
+ <lastmod>2016-06-21</lastmod>
129
129
  <changefreq>daily</changefreq>
130
130
  </url>
131
131
 
132
132
  <url>
133
133
  <loc>None/machinery-show.1/</loc>
134
- <lastmod>2016-04-22</lastmod>
134
+ <lastmod>2016-06-21</lastmod>
135
135
  <changefreq>daily</changefreq>
136
136
  </url>
137
137
 
138
138
  <url>
139
139
  <loc>None/machinery-upgrade-format.1/</loc>
140
- <lastmod>2016-04-22</lastmod>
140
+ <lastmod>2016-06-21</lastmod>
141
141
  <changefreq>daily</changefreq>
142
142
  </url>
143
143
 
144
144
  <url>
145
145
  <loc>None/machinery-validate.1/</loc>
146
- <lastmod>2016-04-22</lastmod>
146
+ <lastmod>2016-06-21</lastmod>
147
147
  <changefreq>daily</changefreq>
148
148
  </url>
149
149
 
@@ -0,0 +1,160 @@
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
+ ],
14
+ "properties": {
15
+ "extracted": {
16
+ "type": "boolean"
17
+ }
18
+ }
19
+ },
20
+ "_elements": {
21
+ "type": "array",
22
+ "items" : {
23
+ "type": "object",
24
+ "required": ["name", "package_name", "package_version"],
25
+ "properties": {
26
+ "name": {
27
+ "type": "string"
28
+ },
29
+ "package_name": {
30
+ "type": "string",
31
+ "minLength": 1
32
+ },
33
+ "package_version": {
34
+ "type": "string",
35
+ "minLength": 1
36
+ }
37
+ },
38
+ "oneOf": [
39
+ { "$ref": "#/definitions/file_changed" },
40
+ { "$ref": "#/definitions/file_error" }
41
+ ]
42
+ }
43
+ }
44
+ },
45
+ "definitions": {
46
+ "file_changed": {
47
+ "required": ["status"],
48
+ "properties": {
49
+ "status": {
50
+ "enum": ["changed"]
51
+ }
52
+ },
53
+ "oneOf": [
54
+ { "$ref": "#/definitions/file_changed_modified" },
55
+ { "$ref": "#/definitions/link_changed_modified" },
56
+ { "$ref": "#/definitions/file_changed_deleted" }
57
+ ]
58
+ },
59
+ "file_changed_modified": {
60
+ "required": ["changes", "mode", "user", "group", "type"],
61
+ "properties": {
62
+ "changes": {
63
+ "type": "array",
64
+ "items": {
65
+ "enum": [
66
+ "size",
67
+ "mode",
68
+ "md5",
69
+ "device_number",
70
+ "link_path",
71
+ "user",
72
+ "group",
73
+ "time",
74
+ "capabilities",
75
+ "replaced",
76
+ "other_rpm_changes"
77
+ ]
78
+ },
79
+ "minItems": 1
80
+ },
81
+ "mode": {
82
+ "type": "string",
83
+ "pattern": "^[0-7]{3,4}$"
84
+ },
85
+ "user": {
86
+ "type": "string",
87
+ "minLength": 1
88
+ },
89
+ "group": {
90
+ "type": "string",
91
+ "minLength": 1
92
+ },
93
+ "type": {
94
+ "enum": ["file", "dir"]
95
+ }
96
+ }
97
+ },
98
+ "link_changed_modified": {
99
+ "required": ["target", "changes", "mode", "user", "group", "type"],
100
+ "properties": {
101
+ "changes": {
102
+ "type": "array",
103
+ "items": {
104
+ "enum": [
105
+ "size",
106
+ "mode",
107
+ "md5",
108
+ "device_number",
109
+ "link_path",
110
+ "user",
111
+ "group",
112
+ "time",
113
+ "capabilities",
114
+ "replaced",
115
+ "other_rpm_changes"
116
+ ]
117
+ },
118
+ "minItems": 1
119
+ },
120
+ "mode": {
121
+ "type": "string",
122
+ "pattern": "^[0-7]{3,4}$"
123
+ },
124
+ "user": {
125
+ "type": "string",
126
+ "minLength": 1
127
+ },
128
+ "group": {
129
+ "type": "string",
130
+ "minLength": 1
131
+ },
132
+ "type": {
133
+ "enum": ["link"]
134
+ },
135
+ "target": {
136
+ "type": "string"
137
+ }
138
+ }
139
+ },
140
+ "file_changed_deleted": {
141
+ "required": ["changes"],
142
+ "properties": {
143
+ "changes": {
144
+ "enum": [["deleted"]]
145
+ }
146
+ }
147
+ },
148
+ "file_error": {
149
+ "required": ["status", "error_message"],
150
+ "properties": {
151
+ "status": {
152
+ "enum": ["error"]
153
+ },
154
+ "error_message": {
155
+ "type": "string"
156
+ }
157
+ }
158
+ }
159
+ }
160
+ }