machinery-tool 1.16.1 → 1.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/.git_revision +1 -1
  3. data/NEWS +19 -0
  4. data/html/partials/changed_managed_files.html.haml +32 -29
  5. data/html/partials/config_files.html.haml +53 -47
  6. data/html/partials/packages.html.haml +20 -17
  7. data/html/partials/patterns.html.haml +14 -11
  8. data/html/partials/repositories.html.haml +25 -22
  9. data/html/partials/services.html.haml +13 -10
  10. data/html/partials/unmanaged_files.html.haml +19 -16
  11. data/lib/build_task.rb +6 -1
  12. data/lib/cli.rb +7 -3
  13. data/lib/compare_task.rb +4 -3
  14. data/lib/current_user.rb +4 -0
  15. data/lib/exceptions.rb +19 -1
  16. data/lib/helper.rb +0 -4
  17. data/lib/kiwi_config.rb +11 -9
  18. data/lib/local_system.rb +6 -2
  19. data/lib/remote_system.rb +2 -2
  20. data/lib/renderer.rb +6 -2
  21. data/lib/rpm_database.rb +11 -1
  22. data/lib/system_description.rb +8 -10
  23. data/lib/version.rb +1 -1
  24. data/machinery-helper/version.go +1 -1
  25. data/man/generated/machinery.1.gz +0 -0
  26. data/man/generated/machinery.1.html +1 -1
  27. data/plugins/changed_managed_files/changed_managed_files_inspector.rb +0 -1
  28. data/plugins/changed_managed_files/changed_managed_files_renderer.rb +4 -1
  29. data/plugins/config_files/config_files_inspector.rb +1 -8
  30. data/plugins/config_files/config_files_renderer.rb +7 -3
  31. data/plugins/environment/environment_inspector.rb +1 -1
  32. data/plugins/os/os_inspector.rb +7 -0
  33. data/plugins/os/os_model.rb +4 -4
  34. data/plugins/packages/packages_renderer.rb +4 -0
  35. data/plugins/patterns/patterns_renderer.rb +4 -0
  36. data/plugins/repositories/repositories_renderer.rb +1 -1
  37. data/plugins/services/services_renderer.rb +4 -0
  38. data/plugins/unmanaged_files/unmanaged_files_renderer.rb +6 -3
  39. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c16d006a71ff2c81996b586fdc18486e2e27494a
4
- data.tar.gz: da1bc592275c11d1ef83244166280458dd3dc1be
3
+ metadata.gz: 0ecc7e8c551b4a94ba94c921c02e198882eb6b85
4
+ data.tar.gz: 156530beeec1101c895e4ebb6cfb27cf393893fd
5
5
  SHA512:
6
- metadata.gz: ad6aa65605ad725a21de1b259de9306631a4c73015f954cc987e320c62171b696ad9a2c35f5ee53783cda9ed1711b2964b312ae1b31bad41766c33e2cc0429f2
7
- data.tar.gz: e1ff5d9957007a85d203bcb5291f0f7de189edb6cbec815d5e2e05ff054b92142ded258fdf669412394b5f828920ef547dbdb7b30739ca7bdc3c6bcc58ae3e0f
6
+ metadata.gz: 9822b03a132a39c6209325c5bfd36963c90f17c8171770d98b2ac351bbca875dd53c1c3bc019ccd394fe16d6775f9c7b993b8dbaff81d2cbc6e7fdbf7767f8d0
7
+ data.tar.gz: 43af578c434b7956a6480dec62ccd3e2678719d345102f03a57b8c6b9cdc15404f92e52b35e53b462f24a135e4978928b5e6df7ac11743ada2ea6bd389bcc6fb
data/.git_revision CHANGED
@@ -1 +1 @@
1
- e2a5941fcf2ffbbcbd765e23e860fc417592fdd1
1
+ 4afb989b21b401f983686603e6521c112630cac9
data/NEWS CHANGED
@@ -1,6 +1,25 @@
1
1
  # Machinery Release Notes
2
2
 
3
3
 
4
+ ## Version 1.16.2 - Tue Nov 24 13:17:18 CET 2015 - thardeck@suse.de
5
+
6
+ * Fix crash when the user does not have enough permissions to create the image
7
+ directory for the `build` command (gh#SUSE/machinery#1667)
8
+ * Fix wrong hint for docker containers while running `analyze` command
9
+ (gh#SUSE/machinery#1632)
10
+ * Add a new hint when using the `--public` option for the `serve` command that it
11
+ makes all descriptions publicly available
12
+ * Fix Machinery failing to inspect changed config files in case of restrictive
13
+ permissions (gh#SUSE/machinery#1609)
14
+ * Remove hint for `show`, when `inspect` is run with `--show` option
15
+ (gh#SUSE/machinery#1648)
16
+ * Fix repository inspection on hosts that have a LANGUAGE variable set
17
+ * Empty scopes now display a message in HTML & CLI views (gh#SUSE/machinery#1615)
18
+ * Fix SLES 11 SP4 os inspector output to be similar to SLES 11 SP3
19
+ * Fix Autoyast export on openSUSE Leap and Tumbleweed (gh#SUSE/machinery#1627)
20
+ * Allow building of openSUSE Leap and Tumbleweed on openSUSE Leap and Tumbleweed
21
+ * Allow building of SLES11 and SLES12 on openSUSE Leap
22
+
4
23
  ## Version 1.16.1 - Mon Nov 09 17:55:15 CET 2015 - thardeck@suse.de
5
24
 
6
25
  * Fix type recognition in case of empty files for config- and changed-managed-files
@@ -1,4 +1,4 @@
1
- - if changed_managed_files && changed_managed_files.files.length > 0
1
+ - if changed_managed_files
2
2
  %div
3
3
  %a.scope_anchor{ id: "changed_managed_files" }
4
4
  .scope#changed_managed_files_container{ "data-scope" => "changed_managed_files" }
@@ -10,32 +10,35 @@
10
10
  .row.scope_content.collapse.in
11
11
  .col-xs-1
12
12
  .col-xs-11
13
- %table.table.table-striped.table-hover.table-condensed.files-table.filterable
14
- %thead
15
- %tr
16
- %th Name
17
- %th Package Name
18
- %th.medium Package Version
19
- %th.medium Changes
20
- %th.small Mode
21
- %th.small User
22
- %th.small Group
23
- %tbody
24
- - changed_managed_files.files.each do |file|
13
+ - if count == 0
14
+ There are no changed managed files.
15
+ - if count > 0
16
+ %table.table.table-striped.table-hover.table-condensed.files-table.filterable
17
+ %thead
25
18
  %tr
26
- %td
27
- - if file.on_disk?
28
- %a.file-download{ href: "#" }
29
- = file.name
30
- - else
31
- %span
32
- = file.name
33
- %td= file.package_name
34
- %td= file.package_version
35
- %td
36
- = file.changes.join(",")
37
- - if file.error_message
38
- %span{ title: file.error_message } (details)
39
- %td= file.mode
40
- %td= file.user
41
- %td= file.group
19
+ %th Name
20
+ %th Package Name
21
+ %th.medium Package Version
22
+ %th.medium Changes
23
+ %th.small Mode
24
+ %th.small User
25
+ %th.small Group
26
+ %tbody
27
+ - changed_managed_files.files.each do |file|
28
+ %tr
29
+ %td
30
+ - if file.on_disk?
31
+ %a.file-download{ href: "#" }
32
+ = file.name
33
+ - else
34
+ %span
35
+ = file.name
36
+ %td= file.package_name
37
+ %td= file.package_version
38
+ %td
39
+ = file.changes.join(",")
40
+ - if file.error_message
41
+ %span{ title: file.error_message } (details)
42
+ %td= file.mode
43
+ %td= file.user
44
+ %td= file.group
@@ -1,4 +1,4 @@
1
- - if config_files && config_files.files.length > 0
1
+ - if config_files
2
2
  %div
3
3
  %a.scope_anchor{ id: "config_files" }
4
4
  .scope#config_files_container{ "data-scope" => "config_files" }
@@ -8,50 +8,56 @@
8
8
  :title => "Config Files",
9
9
  :count => "#{count} #{Machinery.pluralize(count, "file")}"
10
10
  .row.scope_content.collapse.in
11
- - config_files.files.each do |file|
12
- - if file.diff
13
- .diff{ style: "display: none", "data-config-file-diff" => file.diff.file }
14
- %span.diff-summary
15
- #{file.diff.additions} additions & #{file.diff.deletions} deletions
16
- %table.diff
17
- - file.diff.lines.each do |line|
18
- %tr{ class: line.type }
19
- %td.active.linenumber= line.original_line_number
20
- %td.linenumber= line.new_line_number
21
- %td
22
- = line.content
23
- .col-md-1
24
- .col-md-11
25
- %table.table.table-striped.table-hover.table-condensed.files-table.filterable
26
- %thead
27
- %tr
28
- %th Name
29
- %th.medium Package Name
30
- %th.medium Package Version
31
- %th.medium Changes
32
- %th.small Mode
33
- %th.small User
34
- %th.small Group
35
- %tbody
36
- - config_files.files.each do |file|
37
- %tr
38
- %td
39
- %span
40
- - if file.on_disk?
41
- %a.file-download{ href: "#" }
42
- = file.name
43
- - else
11
+ .col-xs-1
12
+ .col-xs-11
13
+ - if count == 0
14
+ There are no config files.
15
+ - if count > 0
16
+ - config_files.files.each do |file|
17
+ - if file.diff
18
+ .diff{ style: "display: none", "data-config-file-diff" => file.diff.file }
19
+ %span.diff-summary
20
+ #{file.diff.additions} additions & #{file.diff.deletions} deletions
21
+ %table.diff
22
+ - file.diff.lines.each do |line|
23
+ %tr{ class: line.type }
24
+ %td.active.linenumber= line.original_line_number
25
+ %td.linenumber= line.new_line_number
26
+ %td
27
+ = line.content
28
+ .col-md-1
29
+ .col-md-11
30
+ %table.table.table-striped.table-hover.table-condensed.files-table.filterable
31
+ %thead
32
+ %tr
33
+ %th Name
34
+ %th.medium Package Name
35
+ %th.medium Package Version
36
+ %th.medium Changes
37
+ %th.small Mode
38
+ %th.small User
39
+ %th.small Group
40
+ %tbody
41
+ - config_files.files.each do |file|
42
+ %tr
43
+ %td
44
44
  %span
45
- = file.name
46
- - if file.diff
47
- %a.diff-toggle{ "data-config-file" => file.name, "data-toggle" => "popover" }
48
- Show diff
49
- %td= file.package_name
50
- %td= file.package_version
51
- %td
52
- = file.changes.join(",")
53
- - if file.error_message
54
- %span{ title: file.error_message } (details)
55
- %td= file.mode
56
- %td= file.user
57
- %td= file.group
45
+ - if file.on_disk?
46
+ %a.file-download{ href: "#" }
47
+ = file.name
48
+ - else
49
+ %span
50
+ = file.name
51
+ - if file.diff
52
+ %a.diff-toggle{ "data-config-file" => file.name,
53
+ "data-toggle" => "popover" }
54
+ Show diff
55
+ %td= file.package_name
56
+ %td= file.package_version
57
+ %td
58
+ = file.changes.join(",")
59
+ - if file.error_message
60
+ %span{ title: file.error_message } (details)
61
+ %td= file.mode
62
+ %td= file.user
63
+ %td= file.group
@@ -10,21 +10,24 @@
10
10
  .row.scope_content.collapse.in
11
11
  .col-xs-1
12
12
  .col-xs-11
13
- %table.table.table-striped.table-hover.table-condensed.filterable
14
- %thead
15
- %tr
16
- %th Name
17
- %th.medium Version
18
- %th.medium Release
19
- %th.medium Arch
20
- %th.medium Vendor
21
- %th Checksum
22
- %tbody
23
- - packages.each do |package|
13
+ - if packages.length == 0
14
+ There are no packages.
15
+ - if packages.length > 0
16
+ %table.table.table-striped.table-hover.table-condensed.filterable
17
+ %thead
24
18
  %tr
25
- %td= package.name
26
- %td= package.version
27
- %td= package.release
28
- %td= package.arch
29
- %td= package.vendor
30
- %td= package.checksum
19
+ %th Name
20
+ %th.medium Version
21
+ %th.medium Release
22
+ %th.medium Arch
23
+ %th.medium Vendor
24
+ %th Checksum
25
+ %tbody
26
+ - packages.each do |package|
27
+ %tr
28
+ %td= package.name
29
+ %td= package.version
30
+ %td= package.release
31
+ %td= package.arch
32
+ %td= package.vendor
33
+ %td= package.checksum
@@ -9,15 +9,18 @@
9
9
  .row.scope_content.collapse.in
10
10
  .col-xs-1
11
11
  .col-xs-11
12
- %table.table.table-striped.table-hover.table-condensed.filterable
13
- %thead
14
- %tr
15
- %th Name
16
- %th.medium Version
17
- %th.medium Release
18
- %tbody
19
- - patterns.each do |pattern|
12
+ - if patterns.length == 0
13
+ There are no patterns.
14
+ - if patterns.length > 0
15
+ %table.table.table-striped.table-hover.table-condensed.filterable
16
+ %thead
20
17
  %tr
21
- %td= pattern.name
22
- %td= pattern.version
23
- %td= pattern.release
18
+ %th Name
19
+ %th.medium Version
20
+ %th.medium Release
21
+ %tbody
22
+ - patterns.each do |pattern|
23
+ %tr
24
+ %td= pattern.name
25
+ %td= pattern.version
26
+ %td= pattern.release
@@ -10,26 +10,29 @@
10
10
  .row.scope_content.collapse.in
11
11
  .col-xs-1
12
12
  .col-xs-11
13
- %table.table.table-striped.table-hover.table-condensed.filterable
14
- %thead
15
- %tr
16
- %th Name
17
- %th Alias
18
- %th.small Type
19
- %th URL
20
- %th.small Enabled
21
- %th.small Autorefresh
22
- %th.small GPG Check
23
- %th.small Priority
24
- %tbody
25
- - repositories.each do |repo|
13
+ - if count == 0
14
+ There are no repositories.
15
+ - if count > 0
16
+ %table.table.table-striped.table-hover.table-condensed.filterable
17
+ %thead
26
18
  %tr
27
- %td= repo.name
28
- %td= repo.alias
29
- %td= repo.type
30
- %td
31
- %a{ href: repo.url }= repo.url
32
- %td= repo.enabled
33
- %td= repo.autorefresh
34
- %td= repo.gpgcheck
35
- %td= repo.priority
19
+ %th Name
20
+ %th Alias
21
+ %th.small Type
22
+ %th URL
23
+ %th.small Enabled
24
+ %th.small Autorefresh
25
+ %th.small GPG Check
26
+ %th.small Priority
27
+ %tbody
28
+ - repositories.each do |repo|
29
+ %tr
30
+ %td= repo.name
31
+ %td= repo.alias
32
+ %td= repo.type
33
+ %td
34
+ %a{ href: repo.url }= repo.url
35
+ %td= repo.enabled
36
+ %td= repo.autorefresh
37
+ %td= repo.gpgcheck
38
+ %td= repo.priority
@@ -10,14 +10,17 @@
10
10
  .row.scope_content.collapse.in
11
11
  .col-xs-1
12
12
  .col-xs-11
13
- %table.table.table-striped.table-hover.table-condensed.filterable
14
- %thead
15
- %tr
16
- %th Name
17
- %th.medium State
18
- %tbody
19
- - services.services.each do |service|
13
+ - if count == 0
14
+ There are no services.
15
+ - if count > 0
16
+ %table.table.table-striped.table-hover.table-condensed.filterable
17
+ %thead
20
18
  %tr
21
- %td= service.name
22
- %td{ class: "#{services.init_system}_#{service.state}" }
23
- = service.state
19
+ %th Name
20
+ %th.medium State
21
+ %tbody
22
+ - services.services.each do |service|
23
+ %tr
24
+ %td= service.name
25
+ %td{ class: "#{services.init_system}_#{service.state}" }
26
+ = service.state
@@ -1,4 +1,4 @@
1
- - if unmanaged_files && unmanaged_files.files.length > 0
1
+ - if unmanaged_files
2
2
  %div
3
3
  %a.scope_anchor{ id: "unmanaged_files" }
4
4
  .scope#unmanaged_files_container{ "data-scope" => "unmanaged_files" }
@@ -10,19 +10,22 @@
10
10
  .row.scope_content.collapse.in
11
11
  .col-xs-1
12
12
  .col-xs-11
13
- %table.table.table-striped.table-hover.table-condensed.files-table.filterable
14
- %thead
15
- %tr
16
- %th Name
17
- %th.medium Type
18
- %tbody
19
- - unmanaged_files.files.each do |file|
13
+ - if count == 0
14
+ There are no unmanaged files.
15
+ - if count > 0
16
+ %table.table.table-striped.table-hover.table-condensed.files-table.filterable
17
+ %thead
20
18
  %tr
21
- %td
22
- - if file.on_disk?
23
- %a.file-download{ href: "#" }
24
- = file.name
25
- - else
26
- %span
27
- = file.name
28
- %td= file.type
19
+ %th Name
20
+ %th.medium Type
21
+ %tbody
22
+ - unmanaged_files.files.each do |file|
23
+ %tr
24
+ %td
25
+ - if file.on_disk?
26
+ %a.file-download{ href: "#" }
27
+ = file.name
28
+ - else
29
+ %span
30
+ = file.name
31
+ %td= file.type
data/lib/build_task.rb CHANGED
@@ -28,7 +28,12 @@ class BuildTask
28
28
  config = KiwiConfig.new(system_description, options)
29
29
  config.write(tmp_config_dir)
30
30
 
31
- FileUtils.mkdir_p(output_path)
31
+ begin
32
+ FileUtils.mkdir_p(output_path)
33
+ rescue Errno::EACCES
34
+ raise Machinery::Errors::BuildDirectoryCreateError.new(output_path, CurrentUser.new.username)
35
+ end
36
+
32
37
  if tmp_image_dir.start_with?("/tmp/") && tmp_config_dir.start_with?("/tmp/")
33
38
  tmp_script = write_kiwi_wrapper(tmp_config_dir, tmp_image_dir,
34
39
  output_path, img_extension)
data/lib/cli.rb CHANGED
@@ -155,11 +155,11 @@ class Cli
155
155
  end
156
156
 
157
157
  def self.check_container_name!(image, name)
158
- if image.include?("/") && name.include?("/")
158
+ if image == name && !SystemDescription.valid_name?(name)
159
159
  raise Machinery::Errors::InvalidCommandLine.new(
160
160
  "Error: System description name '#{name}' is invalid. By default Machinery" \
161
161
  " uses the image name as description name if the parameter `--name` is not" \
162
- " provided.\nIf the image name consist a slash the `--name=NAME` parameter" \
162
+ " provided.\nIf the image name contains a slash the `--name=NAME` parameter" \
163
163
  " is mandatory. Valid characters are 'a-zA-Z0-9_:.-'."
164
164
  )
165
165
  end
@@ -616,7 +616,7 @@ class Cli
616
616
  inspect_options
617
617
  )
618
618
 
619
- Hint.print(:show_data, name: name)
619
+ Hint.print(:show_data, name: name) if options[:show] == false
620
620
 
621
621
  if !options["extract-files"] || Inspector.all_scopes.count != scope_list.count
622
622
  Hint.print(:do_complete_inspection, name: name, host: host)
@@ -920,6 +920,10 @@ class Cli
920
920
 
921
921
  if options[:public]
922
922
  ip = "0.0.0.0"
923
+
924
+ Machinery::Ui.warn("The --public option makes ALL of your system descriptions publicly " \
925
+ "available. Take care if there are system descriptions that should not be read by " \
926
+ "others!\n\n")
923
927
  else
924
928
  ip = "127.0.0.1"
925
929
  end
data/lib/compare_task.rb CHANGED
@@ -70,9 +70,10 @@ EOF
70
70
  identical = false if description1[scope] || description2[scope]
71
71
  end
72
72
  end
73
- output = "Compared descriptions are identical.\n" + output if identical && common_scopes
74
-
75
- if !identical_scopes.empty?
73
+ if identical && common_scopes
74
+ output = "\n" + output unless output.empty?
75
+ output = "Compared descriptions are identical." + output
76
+ elsif !identical_scopes.empty?
76
77
  phrase = Machinery::pluralize(identical_scopes.count, "scope is", "scopes are")
77
78
  output += "Following #{phrase} identical in both descriptions: " + identical_scopes.join(",")
78
79
  end
data/lib/current_user.rb CHANGED
@@ -17,6 +17,10 @@
17
17
 
18
18
  # Represents the user under which Machinery is running.
19
19
  class CurrentUser
20
+ def username
21
+ ENV["USER"]
22
+ end
23
+
20
24
  def is_root?
21
25
  Process.euid == 0
22
26
  end
data/lib/exceptions.rb CHANGED
@@ -65,7 +65,14 @@ module Machinery
65
65
  end.compact.first || "<HOSTNAME>"
66
66
  formatted_scopes = Machinery::Ui.internal_scope_list_to_string(@scopes)
67
67
 
68
- cmd = "#{Hint.program_name} inspect --extract-files --scope=#{formatted_scopes.delete(" ")}"
68
+ if @description["environment"]["system_type"] == "docker"
69
+ inspect_cmd = "inspect-container"
70
+ else
71
+ inspect_cmd = "inspect"
72
+ end
73
+
74
+ cmd = "#{Hint.program_name} #{inspect_cmd} --extract-files " \
75
+ "--scope=#{formatted_scopes.delete(" ")}"
69
76
  cmd += " --name='#{@description.name}'" if hostname != @description.name
70
77
  cmd += " #{hostname}"
71
78
 
@@ -147,5 +154,16 @@ module Machinery
147
154
  @message = message
148
155
  end
149
156
  end
157
+ class BuildDirectoryCreateError < MachineryError
158
+ def initialize(directory, user)
159
+ @directory = directory
160
+ @user = user
161
+ end
162
+
163
+ def to_s
164
+ "Could not create build directory '#{@directory}' because the user '#{@user}' does not " \
165
+ "have sufficient permissions."
166
+ end
167
+ end
150
168
  end
151
169
  end
data/lib/helper.rb CHANGED
@@ -55,10 +55,6 @@ def with_c_locale(&block)
55
55
  with_env "LC_ALL" => "C", &block
56
56
  end
57
57
 
58
- def with_utf8_locale(&block)
59
- with_env "LC_ALL" => "en_US.UTF-8", &block
60
- end
61
-
62
58
  def with_env(env)
63
59
  # ENV isn't a Hash, but a weird Hash-like object. Calling #to_hash on it
64
60
  # will copy its items into a newly created Hash instance. This approach
data/lib/kiwi_config.rb CHANGED
@@ -194,6 +194,12 @@ EOF
194
194
  when OsSles11
195
195
  boot = "vmxboot/suse-SLES11"
196
196
  bootloader = "grub"
197
+ when OsOpenSuseTumbleweed
198
+ boot = "vmxboot/suse-tumbleweed"
199
+ bootloader = "grub2"
200
+ when OsOpenSuseLeap
201
+ boot = "vmxboot/suse-leap42.1"
202
+ bootloader = "grub2"
197
203
  else
198
204
  raise Machinery::Errors::ExportFailed.new(
199
205
  "Export is not possible because the operating system " \
@@ -344,15 +350,11 @@ EOF
344
350
  end
345
351
 
346
352
  def enable_dhcp(output_location)
347
- case @system_description.os
348
- when OsSles11
349
- write_dhcp_network_config(output_location, "eth0")
350
- when OsSles12
351
- write_dhcp_network_config(output_location, "lan0")
352
- write_persistent_net_rules(output_location)
353
- when OsOpenSuse13_1
354
- write_dhcp_network_config(output_location, "lan0")
355
- write_persistent_net_rules(output_location)
353
+ if @system_description.os.is_a?(OsSles11)
354
+ write_dhcp_network_config(output_location, "eth0")
355
+ else
356
+ write_dhcp_network_config(output_location, "lan0")
357
+ write_persistent_net_rules(output_location)
356
358
  end
357
359
  puts "DHCP in built image will be enabled for the first device"
358
360
  end
data/lib/local_system.rb CHANGED
@@ -84,7 +84,7 @@ You can install it by running `zypper install #{package}`.
84
84
  message = <<EOF
85
85
  You are running Machinery on a platform we do not explicitly support and test.
86
86
  It still could work very well. If you run into issues or would like to provide us feedback, you are welcome to file an issue at https://github.com/SUSE/machinery/issues/new or write an email to machinery@lists.suse.com.
87
- Oficially supported operating systems are: '#{supported_oses}'
87
+ Officially supported operating systems are: '#{supported_oses}'
88
88
 
89
89
  To disable this message in the machinery configuration use 'machinery config perform-support-check=false'
90
90
  EOF
@@ -132,7 +132,11 @@ EOF
132
132
  else
133
133
  cheetah_class = LoggedCheetah
134
134
  end
135
- with_utf8_locale do
135
+
136
+ with_env(
137
+ "LANGUAGE" => "",
138
+ "LC_ALL" => locale
139
+ ) do
136
140
  cheetah_class.run(*args)
137
141
  end
138
142
  end
data/lib/remote_system.rb CHANGED
@@ -78,8 +78,8 @@ class RemoteSystem < System
78
78
 
79
79
  sudo = ["sudo", "-n"] if options[:privileged] && remote_user != "root"
80
80
  cmds = [
81
- "ssh", "#{remote_user}@#{host}", "-o", "LogLevel=ERROR", sudo, "LC_ALL=#{locale}",
82
- *piped_args, options
81
+ "ssh", "#{remote_user}@#{host}", "-o", "LogLevel=ERROR", sudo, "LANGUAGE=",
82
+ "LC_ALL=#{locale}", *piped_args, options
83
83
  ].compact.flatten
84
84
  cheetah_class.run(*cmds)
85
85
  rescue Cheetah::ExecutionFailed => e
data/lib/renderer.rb CHANGED
@@ -253,8 +253,12 @@ class Renderer
253
253
  private
254
254
 
255
255
  def print_indented(s)
256
- s.split("\n").each do |line|
257
- @buffer += " " * @indent + line + "\n"
256
+ s.split("\n", -1).each do |line|
257
+ if line.empty?
258
+ @buffer += "\n"
259
+ else
260
+ @buffer += " " * @indent + line + "\n"
261
+ end
258
262
  end
259
263
  end
260
264
 
data/lib/rpm_database.rb CHANGED
@@ -35,6 +35,7 @@ class RpmDatabase
35
35
 
36
36
  def changed_files(&block)
37
37
  return @changed_files if @changed_files
38
+ check_requirements
38
39
 
39
40
  out = @system.run_script_with_progress("changed_files.sh", &block)
40
41
  result = out.each_line.map do |line|
@@ -166,7 +167,8 @@ class RpmDatabase
166
167
  out = @system.run_command(
167
168
  "stat", "--printf", "%a:%U:%G:%u:%g:%F:%n\\n",
168
169
  *cur_files,
169
- stdout: :capture
170
+ stdout: :capture,
171
+ privileged: true
170
172
  )
171
173
  out.each_line do |l|
172
174
  path, values = parse_stat_line(l)
@@ -197,4 +199,12 @@ class RpmDatabase
197
199
  ret.merge!(get_file_properties(cur_files)) unless cur_files.empty?
198
200
  ret
199
201
  end
202
+
203
+ private
204
+
205
+ def check_requirements
206
+ @system.check_requirement("rpm", "--version")
207
+ @system.check_requirement("stat", "--version")
208
+ @system.check_requirement("find", "--version")
209
+ end
200
210
  end
@@ -72,18 +72,16 @@ class SystemDescription < Machinery::Object
72
72
  description
73
73
  end
74
74
 
75
- def validate_name(name)
76
- if ! /^[\w\.:-]*$/.match(name)
77
- raise Machinery::Errors::SystemDescriptionError.new(
78
- "System description name '#{name}' is invalid. " +
79
- "Only 'a-zA-Z0-9_:.-' are valid characters."
80
- )
81
- end
75
+ def valid_name?(name)
76
+ !!/^[\w:-][\w\.:-]*$/.match(name)
77
+ end
82
78
 
83
- if name.start_with?(".")
79
+ def validate_name(name)
80
+ unless valid_name?(name)
84
81
  raise Machinery::Errors::SystemDescriptionError.new(
85
- "System description name '#{name}' is invalid. " +
86
- "A dot is not allowed as first character."
82
+ "System description name '#{name}' is invalid. " \
83
+ "Only 'a-zA-Z0-9_:.-' are valid characters and a dot " \
84
+ "is not allowed at the begginning."
87
85
  )
88
86
  end
89
87
  end
data/lib/version.rb CHANGED
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Machinery
19
19
 
20
- VERSION = "1.16.1"
20
+ VERSION = "1.16.2"
21
21
 
22
22
  end
@@ -2,4 +2,4 @@
2
2
 
3
3
  package main
4
4
 
5
- const VERSION = "e2a5941fcf2ffbbcbd765e23e860fc417592fdd1"
5
+ const VERSION = "4afb989b21b401f983686603e6521c112630cac9"
Binary file
@@ -905,7 +905,7 @@ via <code>ssh-copy-id</code> to the inspected host, e.g.: <code>ssh-copy-id root
905
905
  <li><p>When inspecting as non-root the user has to have the following command
906
906
  whitelist given in the sudoers file:</p>
907
907
 
908
- <p>machinery ALL=(ALL) NOPASSWD: /usr/bin/find,/usr/bin/cat,/bin/cat,/usr/bin/rsync,/bin/rpm -Va *,/bin/tar --create *</p></li>
908
+ <p>machinery ALL=(ALL) NOPASSWD: /usr/bin/find,/usr/bin/cat,/bin/cat,/usr/bin/rsync,/bin/rpm -Va *,/bin/tar --create *,/usr/bin/stat</p></li>
909
909
  <li><p>To add a remote <code>machinery</code> user run as root:</p>
910
910
 
911
911
  <h1><code>useradd -m machinery -c "remote user for machinery"</code></h1>
@@ -24,7 +24,6 @@ class ChangedManagedFilesInspector < Inspector
24
24
  end
25
25
 
26
26
  def inspect(filter, options = {})
27
- system.check_requirement("find", "--version")
28
27
  system.check_retrieve_files_dependencies if options[:extract_changed_managed_files]
29
28
 
30
29
  @system = system
@@ -27,7 +27,10 @@ class ChangedManagedFilesRenderer < Renderer
27
27
 
28
28
  list do
29
29
  file_status = description["changed_managed_files"].extracted
30
- if !file_status.nil?
30
+
31
+ if files.empty?
32
+ puts "There are no changed managed files."
33
+ elsif !file_status.nil?
31
34
  puts "Files extracted: #{file_status ? "yes" : "no"}"
32
35
  end
33
36
 
@@ -17,13 +17,6 @@
17
17
 
18
18
  class ConfigFilesInspector < Inspector
19
19
  has_priority 80
20
- # checks if all required binaries are present
21
- def check_requirements(check_rsync)
22
- @system.check_requirement("rpm", "--version")
23
- @system.check_requirement("stat", "--version")
24
- @system.check_requirement("find", "--version")
25
- @system.check_retrieve_files_dependencies if check_rsync
26
- end
27
20
 
28
21
  # returns a hash with entries for changed config files
29
22
  def config_file_changes(pkg)
@@ -45,7 +38,7 @@ class ConfigFilesInspector < Inspector
45
38
 
46
39
  def inspect(filter, options = {})
47
40
  do_extract = options[:extract_changed_config_files]
48
- check_requirements(do_extract)
41
+ system.check_retrieve_files_dependencies if do_extract
49
42
 
50
43
  count = 0
51
44
  files = @system.rpm_database.changed_files do |chunk|
@@ -31,10 +31,14 @@ class ConfigFilesRenderer < Renderer
31
31
 
32
32
  list do
33
33
  file_status = description["config_files"].extracted
34
- if !file_status.nil?
34
+ files = description["config_files"].files
35
+
36
+ if files.empty?
37
+ puts "There are no config files."
38
+ elsif !file_status.nil?
35
39
  puts "Files extracted: #{file_status ? "yes" : "no"}"
36
40
  end
37
- files = description["config_files"].files
41
+
38
42
  if files
39
43
  files.each do |p|
40
44
  item_content = "#{p.name} (#{p.package_name}-#{p.package_version}, " \
@@ -78,7 +82,7 @@ class ConfigFilesRenderer < Renderer
78
82
  path = File.join(diffs_dir, name + ".diff")
79
83
 
80
84
  if File.exists?(path)
81
- puts "Diff:\n#{File.read(path)}"
85
+ puts "Diff:\n#{File.read(path).chomp}"
82
86
  else
83
87
  Machinery::Ui.warn "Diff for #{name} was not found on disk."
84
88
  end
@@ -43,7 +43,7 @@ class EnvironmentInspector < Inspector
43
43
  end
44
44
 
45
45
  all_locales = output.split
46
- locale = ["en_US.utf8"].find { |l| all_locales.include?(l) }
46
+ locale = all_locales.find { |l| l.downcase.match(/en_us.utf.?8/) }
47
47
 
48
48
  locale || "C"
49
49
  end
@@ -99,6 +99,13 @@ class OsInspector < Inspector
99
99
  if result["pretty_name"] =~ /^openSUSE.*Leap/
100
100
  result["pretty_name"] = "openSUSE Leap"
101
101
  end
102
+
103
+ # converts SLES11 SP4 result to SP3 style
104
+ # the results are different because SP4 has an os-release
105
+ if result["pretty_name"] =~ /^SUSE Linux Enterprise Server 11 (SP\d)$/
106
+ result["pretty_name"] = "SUSE Linux Enterprise Server 11"
107
+ result["version"] = "11 #{$1}"
108
+ end
102
109
  end
103
110
  # return pretty_name as name as it contains the actual full length
104
111
  # name instead of an abbreviation
@@ -178,7 +178,7 @@ class OsOpenSuse13_2 < OsOpenSuse
178
178
  end
179
179
  end
180
180
 
181
- class OsOpenSuseTumbleweed < Os
181
+ class OsOpenSuseTumbleweed < OsSuse
182
182
  def display_name
183
183
  "#{name} (#{architecture})"
184
184
  end
@@ -188,11 +188,11 @@ class OsOpenSuseTumbleweed < Os
188
188
  end
189
189
 
190
190
  def self.buildable_systems
191
- [OsOpenSuse13_2]
191
+ [OsOpenSuse13_2, OsOpenSuseTumbleweed, OsOpenSuseLeap]
192
192
  end
193
193
  end
194
194
 
195
- class OsOpenSuseLeap < Os
195
+ class OsOpenSuseLeap < OsSuse
196
196
  def display_name
197
197
  "#{name} (#{architecture})"
198
198
  end
@@ -202,7 +202,7 @@ class OsOpenSuseLeap < Os
202
202
  end
203
203
 
204
204
  def self.buildable_systems
205
- [OsOpenSuse13_2, OsOpenSuseLeap]
205
+ [OsOpenSuse13_1, OsOpenSuse13_2, OsOpenSuseLeap, OsOpenSuseTumbleweed, OsSles12, OsSles11]
206
206
  end
207
207
  end
208
208
 
@@ -23,6 +23,10 @@ class PackagesRenderer < Renderer
23
23
  def content(description)
24
24
  return unless description.packages
25
25
 
26
+ if description.packages.empty?
27
+ puts "There are no packages."
28
+ end
29
+
26
30
  list do
27
31
  description.packages.each do |p|
28
32
  item "#{p.name}-#{p.version}-#{p.release}.#{p.arch} (#{p.vendor})"
@@ -19,6 +19,10 @@ class PatternsRenderer < Renderer
19
19
  def content(description)
20
20
  return unless description.patterns
21
21
 
22
+ if description.patterns.empty?
23
+ puts "There are no patterns."
24
+ end
25
+
22
26
  list do
23
27
  description.patterns.each do |p|
24
28
  item "#{p.name}"
@@ -20,7 +20,7 @@ class RepositoriesRenderer < Renderer
20
20
  return unless description.repositories
21
21
 
22
22
  if description.repositories.empty?
23
- puts "System has no repositories"
23
+ puts "There are no repositories."
24
24
  end
25
25
 
26
26
  list do
@@ -19,6 +19,10 @@ class ServicesRenderer < Renderer
19
19
  def content(description)
20
20
  return unless description["services"]
21
21
 
22
+ if description["services"].services.empty?
23
+ puts "There are no services."
24
+ end
25
+
22
26
  list do
23
27
  description["services"].services.each do |p|
24
28
  item "#{p.name}: #{p.state}"
@@ -21,15 +21,18 @@ class UnmanagedFilesRenderer < Renderer
21
21
 
22
22
  list do
23
23
  file_status = description["unmanaged_files"].extracted
24
- if !file_status.nil?
24
+
25
+ if description["unmanaged_files"].files.empty?
26
+ puts "There are no unmanaged files."
27
+ elsif !file_status.nil?
25
28
  puts "Files extracted: #{file_status ? "yes" : "no"}"
26
29
  end
27
30
 
28
31
  if description["unmanaged_files"].files
29
32
  description["unmanaged_files"].files.each do |p|
30
- if p.user && p.group
33
+ if description["unmanaged_files"].extracted
31
34
  item "#{p.name} (#{p.type})" do
32
- puts "User/Group: #{p.user}:#{p.group}"
35
+ puts "User/Group: #{p.user}:#{p.group}" if p.user || p.group
33
36
  puts "Mode: #{p.mode}" if p.mode
34
37
  puts "Size: #{number_to_human_size(p.size)}" if p.size
35
38
  puts "Files: #{p.files}" if p.files
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: machinery-tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.1
4
+ version: 1.16.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SUSE
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2015-11-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cheetah
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.6.0
61
+ version: 1.6.3
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.6.0
68
+ version: 1.6.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: gli
71
71
  requirement: !ruby/object:Gem::Requirement