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.
- checksums.yaml +4 -4
- data/.git_revision +1 -1
- data/NEWS +17 -0
- data/bin/machinery +10 -2
- data/html/comparison.html.haml +1 -1
- data/html/index.html.haml +2 -2
- data/html/partials/{config_files.html.haml → changed_config_files.html.haml} +10 -10
- data/html/partials/compare/changed_config_files.html.haml +48 -0
- data/html/partials/compare/{config_file_list.html.haml → changed_config_files_list.html.haml} +0 -0
- data/html/partials/compare/unmanaged_file_list.html.haml +1 -1
- data/html/partials/compare/unmanaged_files.html.haml +2 -2
- data/html/partials/patterns.html.haml +5 -0
- data/html/upgrade.html.haml +49 -0
- data/lib/{analyze_config_file_diffs_task.rb → analyze_changed_config_files_diffs_task.rb} +8 -8
- data/lib/autoyast.rb +12 -13
- data/lib/build_task.rb +2 -2
- data/lib/cli.rb +39 -32
- data/lib/compare_task.rb +1 -1
- data/lib/config_base.rb +1 -1
- data/lib/deploy_task.rb +4 -4
- data/lib/docker_system.rb +1 -1
- data/lib/element_filter.rb +3 -3
- data/lib/export_task.rb +3 -3
- data/lib/file_validator.rb +8 -5
- data/lib/filter.rb +5 -5
- data/lib/filter_option_parser.rb +3 -3
- data/lib/hint.rb +9 -4
- data/lib/html.rb +3 -3
- data/lib/inspect_task.rb +3 -3
- data/lib/json_schema_monkey_patch.rb +2 -2
- data/lib/json_validation_error_cleaner.rb +1 -1
- data/lib/json_validator.rb +2 -2
- data/lib/kiwi_config.rb +39 -14
- data/lib/list_task.rb +1 -1
- data/lib/local_system.rb +4 -4
- data/lib/machinery.rb +1 -1
- data/lib/machinery_logger.rb +4 -4
- data/lib/manifest.rb +5 -5
- data/lib/migration.rb +4 -4
- data/lib/object.rb +6 -10
- data/lib/remove_task.rb +1 -1
- data/lib/renderer.rb +5 -5
- data/lib/scope_file_access_archive.rb +2 -2
- data/lib/scope_file_access_flat.rb +3 -3
- data/lib/scope_file_store.rb +3 -3
- data/lib/serve_html_task.rb +15 -2
- data/lib/server.rb +32 -12
- data/lib/system.rb +1 -1
- data/lib/system_description.rb +16 -14
- data/lib/system_description_store.rb +5 -6
- data/lib/ui.rb +1 -1
- data/lib/upgrade_format_task.rb +2 -2
- data/lib/version.rb +1 -1
- data/lib/workload_mapper.rb +11 -11
- data/lib/zypper.rb +1 -1
- data/machinery-helper/Rakefile +1 -1
- data/machinery-helper/version.go +1 -1
- data/man/generated/machinery.1.gz +0 -0
- data/manual/docs/machinery-analyze.1.md +3 -3
- data/manual/docs/machinery-compare.1.md +2 -2
- data/manual/docs/machinery-inspect-docker.1.md +1 -1
- data/manual/docs/machinery-inspect.1.md +4 -1
- data/manual/docs/machinery-show.1.md +2 -2
- data/manual/docs/machinery_main_general.1.md +1 -1
- data/manual/docs/machinery_main_scopes.1.md +8 -6
- data/manual/site/machinery-analyze.1/index.html +3 -3
- data/manual/site/machinery-compare.1/index.html +2 -2
- data/manual/site/machinery-inspect-docker.1/index.html +1 -1
- data/manual/site/machinery-inspect.1/index.html +3 -1
- data/manual/site/machinery-show.1/index.html +2 -2
- data/manual/site/machinery_main_general.1/index.html +1 -1
- data/manual/site/machinery_main_scopes.1/index.html +8 -6
- data/manual/site/mkdocs/search_index.json +17 -17
- data/manual/site/sitemap.xml +23 -23
- data/plugins/{config_files/config_files.yml → changed_config_files/changed_config_files.yml} +3 -3
- data/plugins/{config_files/config_files_inspector.rb → changed_config_files/changed_config_files_inspector.rb} +14 -10
- data/plugins/{config_files/config_files_model.rb → changed_config_files/changed_config_files_model.rb} +1 -1
- data/plugins/{config_files/config_files_renderer.rb → changed_config_files/changed_config_files_renderer.rb} +9 -9
- 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
- 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
- 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
- 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
- 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
- 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
- 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
- data/plugins/changed_config_files/schema/system-description-changed-config-files.schema-v8.json +160 -0
- data/plugins/changed_managed_files/changed_managed_files_inspector.rb +6 -2
- data/plugins/changed_managed_files/changed_managed_files_renderer.rb +1 -1
- data/plugins/changed_managed_files/schema/system-description-changed-managed-files.schema-v8.json +160 -0
- data/plugins/environment/schema/system-description-environment.schema-v8.json +17 -0
- data/plugins/groups/groups_inspector.rb +1 -1
- data/plugins/groups/groups_renderer.rb +1 -1
- data/plugins/groups/schema/system-description-groups.schema-v8.json +49 -0
- data/plugins/os/os_inspector.rb +6 -6
- data/plugins/os/os_renderer.rb +1 -1
- data/plugins/os/schema/system-description-os.schema-v8.json +21 -0
- data/plugins/packages/packages_inspector.rb +1 -1
- data/plugins/packages/schema/system-description-packages.schema-v8.json +115 -0
- data/plugins/patterns/patterns.yml +5 -3
- data/plugins/patterns/patterns_inspector.rb +4 -3
- data/plugins/patterns/patterns_renderer.rb +5 -1
- data/plugins/patterns/schema/system-description-patterns.schema-v8.json +58 -0
- data/plugins/repositories/repositories_inspector.rb +2 -1
- data/plugins/repositories/schema/system-description-repositories.schema-v8.json +165 -0
- data/plugins/services/schema/system-description-services.schema-v8.json +93 -0
- data/plugins/services/services.yml +1 -1
- data/plugins/services/services_inspector.rb +1 -1
- data/plugins/unmanaged_files/schema/system-description-unmanaged-files.schema-v8.json +124 -0
- data/plugins/unmanaged_files/unmanaged_files_inspector.rb +9 -4
- data/plugins/unmanaged_files/unmanaged_files_model.rb +12 -5
- data/plugins/unmanaged_files/unmanaged_files_renderer.rb +1 -1
- data/plugins/users/schema/system-description-users.schema-v8.json +86 -0
- data/plugins/users/users_inspector.rb +7 -7
- data/schema/migrations/migrate1to2.rb +4 -4
- data/schema/migrations/migrate2to3.rb +1 -1
- data/schema/migrations/migrate3to4.rb +9 -9
- data/schema/migrations/migrate7to8.rb +47 -0
- data/schema/system-description-global.schema-v8.json +43 -0
- data/workload_mapper/rails/setup/setup.rb.erb +1 -1
- data/workload_mapper/wordpress/setup/setup.rb.erb +1 -1
- metadata +31 -17
- data/html/partials/compare/config_files.html.haml +0 -48
data/lib/html.rb
CHANGED
@@ -30,17 +30,17 @@ class Html
|
|
30
30
|
|
31
31
|
Machinery::Ui.warn <<-EOF.chomp
|
32
32
|
Warning:
|
33
|
-
The --public option makes the HTTP server listen on all configured IP addresses. Everyone who has access to one of those IP addresses can access all of your system descriptions stored in '~/.machinery'. Be careful if there
|
33
|
+
The --public option makes the HTTP server listen on all configured IP addresses. Everyone who has access to one of those IP addresses can access all of your system descriptions stored in '~/.machinery'. Be careful if there is sensitive information (such as private keys) stored in one of your descriptions.
|
34
34
|
EOF
|
35
35
|
elsif opts[:ip] == "0.0.0.0"
|
36
36
|
Machinery::Ui.warn <<-EOF.chomp
|
37
37
|
Warning:
|
38
|
-
The server is listening on all configured IP addresses. Everyone who has access to one of those IP addresses can access all of your system descriptions stored in '~/.machinery'. Be careful if there
|
38
|
+
The server is listening on all configured IP addresses. Everyone who has access to one of those IP addresses can access all of your system descriptions stored in '~/.machinery'. Be careful if there is sensitive information (such as private keys) stored in one of your descriptions.
|
39
39
|
EOF
|
40
40
|
elsif opts[:ip] && opts[:ip] != "localhost" && opts[:ip] != "127.0.0.1"
|
41
41
|
Machinery::Ui.warn <<-EOF.chomp
|
42
42
|
Warning:
|
43
|
-
You specified an IP address other than '127.0.0.1', your server may be reachable from the network. Everyone who can access that network can access your system descriptions stored in '~/.machinery'. Be careful if there
|
43
|
+
You specified an IP address other than '127.0.0.1', your server may be reachable from the network. Everyone who can access that network can access your system descriptions stored in '~/.machinery'. Be careful if there is sensitive information (such as private keys) stored in one of your descriptions.
|
44
44
|
EOF
|
45
45
|
elsif !opts[:ip]
|
46
46
|
opts[:ip] = "127.0.0.1"
|
data/lib/inspect_task.rb
CHANGED
@@ -21,11 +21,11 @@ class InspectTask
|
|
21
21
|
description, failed_inspections = build_description(store, name, system,
|
22
22
|
scopes, filter, options)
|
23
23
|
|
24
|
-
|
24
|
+
unless description.attributes.empty?
|
25
25
|
print_description(description, scopes) if options[:show]
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
unless failed_inspections.empty?
|
29
29
|
Machinery::Ui.puts "\n"
|
30
30
|
message = failed_inspections.map { |scope, msg|
|
31
31
|
"Errors while inspecting " \
|
@@ -92,7 +92,7 @@ class InspectTask
|
|
92
92
|
end
|
93
93
|
description[inspector.scope].set_metadata(timestring, host)
|
94
94
|
|
95
|
-
|
95
|
+
unless description.attributes.empty?
|
96
96
|
effective_filter.apply!(description)
|
97
97
|
description.set_filter_definitions("inspect", effective_filter.to_array)
|
98
98
|
description.save
|
@@ -9,10 +9,10 @@ module JSON
|
|
9
9
|
class Schema
|
10
10
|
class EnumAttribute < Attribute
|
11
11
|
def self.validate(current_schema, data, fragments, processor, validator, options = {})
|
12
|
-
|
12
|
+
unless current_schema.schema["enum"].include?(data)
|
13
13
|
if options[:record_errors]
|
14
14
|
message = "The property '#{build_fragment(fragments)}' value #{data.inspect} did not match one of the following values:"
|
15
|
-
current_schema.schema[
|
15
|
+
current_schema.schema["enum"].each {|val|
|
16
16
|
if val.is_a?(NilClass)
|
17
17
|
message += " null,"
|
18
18
|
elsif val.is_a?(Array)
|
@@ -33,7 +33,7 @@ class JsonValidationErrorCleaner
|
|
33
33
|
|
34
34
|
new_path = "The property"
|
35
35
|
new_path += " ##{position}" if position > -1
|
36
|
-
new_path += " (#{details})"
|
36
|
+
new_path += " (#{details})" unless details.empty?
|
37
37
|
|
38
38
|
message.gsub(/The property '#\/.*?'/, new_path)
|
39
39
|
end
|
data/lib/json_validator.rb
CHANGED
@@ -21,7 +21,7 @@ class JsonValidator
|
|
21
21
|
|
22
22
|
format_version = @json_hash["meta"]["format_version"] if @json_hash["meta"]
|
23
23
|
|
24
|
-
|
24
|
+
unless format_version
|
25
25
|
raise Machinery::Errors::SystemDescriptionValidationFailed.new(
|
26
26
|
["Could not determine format version"]
|
27
27
|
)
|
@@ -47,7 +47,7 @@ class JsonValidator
|
|
47
47
|
private
|
48
48
|
|
49
49
|
def validate_scope(scope_hash, scope)
|
50
|
-
return []
|
50
|
+
return [] unless @scope_schemas[scope]
|
51
51
|
|
52
52
|
errors = JSON::Validator.fully_validate(@scope_schemas[scope], scope_hash).map do |error|
|
53
53
|
"In scope #{scope}: #{error}"
|
data/lib/kiwi_config.rb
CHANGED
@@ -57,6 +57,28 @@ class KiwiConfig < Exporter
|
|
57
57
|
|
58
58
|
private
|
59
59
|
|
60
|
+
def optional_bootstrap_packages
|
61
|
+
[
|
62
|
+
"glibc-locale",
|
63
|
+
"module-init-tools",
|
64
|
+
"cracklib-dict-full",
|
65
|
+
"ca-certificates",
|
66
|
+
"ca-certificates-mozilla"
|
67
|
+
]
|
68
|
+
end
|
69
|
+
|
70
|
+
def add_bootstrap_packages(xml)
|
71
|
+
xml.packages(type: "bootstrap") do
|
72
|
+
xml.package(name: "filesystem")
|
73
|
+
bootstrap_packages = @system_description.packages.select { |package|
|
74
|
+
optional_bootstrap_packages.include?(package.name)
|
75
|
+
}
|
76
|
+
bootstrap_packages.each do |package|
|
77
|
+
xml.package(name: package.name)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
60
82
|
def pre_process_config
|
61
83
|
enable_ssh if @options[:enable_ssh]
|
62
84
|
end
|
@@ -96,8 +118,8 @@ class KiwiConfig < Exporter
|
|
96
118
|
end
|
97
119
|
|
98
120
|
def inject_extracted_files(output_location)
|
99
|
-
["changed_managed_files", "
|
100
|
-
next
|
121
|
+
["changed_managed_files", "changed_config_files"].each do |scope|
|
122
|
+
next unless @system_description.scope_extracted?(scope)
|
101
123
|
|
102
124
|
output_root_path = File.join(output_location, "root")
|
103
125
|
FileUtils.mkdir_p(output_root_path)
|
@@ -147,7 +169,7 @@ EOF
|
|
147
169
|
|
148
170
|
def check_existance_of_extracted_files
|
149
171
|
missing_scopes = []
|
150
|
-
["
|
172
|
+
["changed_config_files", "changed_managed_files", "unmanaged_files"].each do |scope|
|
151
173
|
|
152
174
|
if @system_description[scope] &&
|
153
175
|
!@system_description.scope_file_store(scope).path
|
@@ -155,7 +177,7 @@ EOF
|
|
155
177
|
end
|
156
178
|
end
|
157
179
|
|
158
|
-
|
180
|
+
unless missing_scopes.empty?
|
159
181
|
raise Machinery::Errors::MissingExtractedFiles.new(@system_description, missing_scopes)
|
160
182
|
end
|
161
183
|
end
|
@@ -234,7 +256,9 @@ EOF
|
|
234
256
|
File.join(Machinery::ROOT, "filters", "filter-packages-for-build.yaml")
|
235
257
|
) || []
|
236
258
|
|
237
|
-
xml
|
259
|
+
add_bootstrap_packages(xml)
|
260
|
+
|
261
|
+
xml.packages(type: "image") do
|
238
262
|
if @system_description.packages
|
239
263
|
@system_description.packages.each do |package|
|
240
264
|
next if filter.include?(package.name)
|
@@ -268,16 +292,17 @@ EOF
|
|
268
292
|
xml.source(path: repo.url)
|
269
293
|
end
|
270
294
|
end
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
295
|
+
|
296
|
+
next if repo.url =~ /^https:\/\/nu.novell.com|^https:\/\/update.suse.com/
|
297
|
+
|
298
|
+
@sh << "zypper -n ar --name='#{repo.name}' "
|
299
|
+
@sh << "--type='#{repo.type}' " if repo.type
|
300
|
+
@sh << "--refresh " if repo.autorefresh
|
301
|
+
@sh << "--disable " unless repo.enabled
|
302
|
+
@sh << "'#{repo.url}' '#{repo.alias}'\n"
|
303
|
+
@sh << "zypper -n mr --priority=#{repo.priority} '#{repo.name}'\n"
|
279
304
|
end
|
280
|
-
|
305
|
+
unless usable_repositories
|
281
306
|
raise(
|
282
307
|
Machinery::Errors::MissingRequirement.new(
|
283
308
|
"The system description doesn't contain any enabled or network reachable repository." \
|
data/lib/list_task.rb
CHANGED
data/lib/local_system.rb
CHANGED
@@ -20,7 +20,7 @@ class LocalSystem < System
|
|
20
20
|
|
21
21
|
class << self
|
22
22
|
def os
|
23
|
-
|
23
|
+
unless @@os
|
24
24
|
description = SystemDescription.new("localhost", SystemDescriptionMemoryStore.new)
|
25
25
|
inspector = OsInspector.new(System.for("localhost"), description)
|
26
26
|
inspector.inspect(nil)
|
@@ -57,10 +57,10 @@ Run `zypper install #{package}` to install the package.
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
|
60
|
+
unless missing_packages.empty?
|
61
61
|
count = missing_packages.count
|
62
62
|
error_string = <<-EOF
|
63
|
-
You need the #{Machinery
|
63
|
+
You need the #{Machinery.pluralize(count, "package")} '#{missing_packages.join("\',\'")}'.
|
64
64
|
You can install it by running `zypper install #{missing_packages.join(" ")}`.
|
65
65
|
EOF
|
66
66
|
raise(Machinery::Errors::MissingRequirement.new(error_string))
|
@@ -82,7 +82,7 @@ You can install it by running `zypper install #{package}`.
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def validate_architecture(arch)
|
85
|
-
|
85
|
+
unless matches_architecture?(arch)
|
86
86
|
raise(Machinery::Errors::UnsupportedArchitecture.new(
|
87
87
|
"This operation is not supported on architecture '#{os.architecture}'."
|
88
88
|
))
|
data/lib/machinery.rb
CHANGED
@@ -74,7 +74,7 @@ require_relative "renderer_helper"
|
|
74
74
|
require_relative "export_task"
|
75
75
|
require_relative "helper"
|
76
76
|
require_relative "deploy_task"
|
77
|
-
require_relative "
|
77
|
+
require_relative "analyze_changed_config_files_diffs_task"
|
78
78
|
require_relative "copy_task"
|
79
79
|
require_relative "scope"
|
80
80
|
require_relative "ui"
|
data/lib/machinery_logger.rb
CHANGED
@@ -20,15 +20,15 @@ module Machinery
|
|
20
20
|
|
21
21
|
def self.initialize_logger(log_file)
|
22
22
|
# We rotate one old log file of 21 MB
|
23
|
-
if File.
|
23
|
+
if File.exist?(log_file) && File.size(log_file) > 21 * 1024 * 1024
|
24
24
|
rotated_file = log_file + ".0"
|
25
|
-
FileUtils.rm(rotated_file) if File.
|
25
|
+
FileUtils.rm(rotated_file) if File.exist?(rotated_file)
|
26
26
|
FileUtils.mv(log_file, rotated_file)
|
27
27
|
end
|
28
28
|
|
29
|
-
|
29
|
+
unless File.exist?(log_file)
|
30
30
|
dirname = File.dirname(log_file)
|
31
|
-
|
31
|
+
unless Dir.exist?(dirname)
|
32
32
|
FileUtils.mkdir_p(dirname)
|
33
33
|
File.chmod(0700, dirname)
|
34
34
|
end
|
data/lib/manifest.rb
CHANGED
@@ -22,7 +22,7 @@ class Manifest
|
|
22
22
|
attr_accessor :name, :path, :json, :hash
|
23
23
|
|
24
24
|
def self.load(name, path)
|
25
|
-
unless File.
|
25
|
+
unless File.exist?(path)
|
26
26
|
raise Machinery::Errors::SystemDescriptionNotFound.new(
|
27
27
|
"Couldn't find a system description with the name '#{name}'."
|
28
28
|
)
|
@@ -41,20 +41,20 @@ class Manifest
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def validate
|
44
|
-
return
|
44
|
+
return unless compatible_json?
|
45
45
|
|
46
46
|
errors = JsonValidator.new(@hash).validate
|
47
|
-
|
47
|
+
unless errors.empty?
|
48
48
|
Machinery::Ui.warn("Warning: System Description validation errors:")
|
49
49
|
Machinery::Ui.warn(errors.join("\n"))
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
def validate!
|
54
|
-
return
|
54
|
+
return unless compatible_json?
|
55
55
|
|
56
56
|
errors = JsonValidator.new(@hash).validate
|
57
|
-
|
57
|
+
unless errors.empty?
|
58
58
|
raise Machinery::Errors::SystemDescriptionValidationFailed.new(errors)
|
59
59
|
end
|
60
60
|
end
|
data/lib/migration.rb
CHANGED
@@ -49,8 +49,8 @@
|
|
49
49
|
# EOT
|
50
50
|
#
|
51
51
|
# def migrate
|
52
|
-
# is_extracted = Dir.
|
53
|
-
# @hash["
|
52
|
+
# is_extracted = Dir.exist?(File.join(@path, "config-files"))
|
53
|
+
# @hash["changed_config_files"]["extracted"] = is_extracted
|
54
54
|
# end
|
55
55
|
# end
|
56
56
|
class Migration
|
@@ -70,7 +70,7 @@ class Migration
|
|
70
70
|
|
71
71
|
errors = JsonValidator.new(hash).validate
|
72
72
|
errors += FileValidator.new(hash, store.description_path(description_name)).validate
|
73
|
-
|
73
|
+
unless errors.empty?
|
74
74
|
if options[:force]
|
75
75
|
Machinery::Ui.warn("Warning: System Description validation errors:")
|
76
76
|
Machinery::Ui.warn(errors.join(", "))
|
@@ -80,7 +80,7 @@ class Migration
|
|
80
80
|
end
|
81
81
|
|
82
82
|
current_version = hash["meta"]["format_version"]
|
83
|
-
|
83
|
+
unless current_version
|
84
84
|
raise Machinery::Errors::SystemDescriptionIncompatible.new(
|
85
85
|
"The system description '#{description_name}' was generated by an old " \
|
86
86
|
"version of machinery that is not supported by the upgrade mechanism."
|
data/lib/object.rb
CHANGED
@@ -112,16 +112,12 @@ module Machinery
|
|
112
112
|
end
|
113
113
|
key = name.to_s[0..-2]
|
114
114
|
@attributes[key] = self.class.convert_element(key, args.first)
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
|
119
|
-
end
|
120
|
-
|
121
|
-
@attributes[name.to_s]
|
122
|
-
else
|
123
|
-
nil
|
115
|
+
elsif @attributes.key?(name.to_s)
|
116
|
+
unless args.empty?
|
117
|
+
raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
|
124
118
|
end
|
119
|
+
|
120
|
+
@attributes[name.to_s]
|
125
121
|
end
|
126
122
|
end
|
127
123
|
|
@@ -129,7 +125,7 @@ module Machinery
|
|
129
125
|
if name.to_s.end_with?("=")
|
130
126
|
true
|
131
127
|
else
|
132
|
-
@attributes.
|
128
|
+
@attributes.key?(name) || super(name, include_all)
|
133
129
|
end
|
134
130
|
end
|
135
131
|
|
data/lib/remove_task.rb
CHANGED
data/lib/renderer.rb
CHANGED
@@ -161,7 +161,7 @@ class Renderer
|
|
161
161
|
end
|
162
162
|
|
163
163
|
def render_comparison_common(description)
|
164
|
-
return
|
164
|
+
return unless description[scope]
|
165
165
|
|
166
166
|
puts "Common to both systems:"
|
167
167
|
indent { compare_content_common(description) }
|
@@ -182,10 +182,10 @@ class Renderer
|
|
182
182
|
@stack = []
|
183
183
|
missing_descriptions = Array.new
|
184
184
|
|
185
|
-
|
185
|
+
unless description1[scope]
|
186
186
|
missing_descriptions << description1.name
|
187
187
|
end
|
188
|
-
|
188
|
+
unless description2[scope]
|
189
189
|
missing_descriptions << description2.name
|
190
190
|
end
|
191
191
|
|
@@ -205,7 +205,7 @@ class Renderer
|
|
205
205
|
end
|
206
206
|
|
207
207
|
def puts(s)
|
208
|
-
print_indented
|
208
|
+
print_indented Machinery.scrub(s)
|
209
209
|
end
|
210
210
|
|
211
211
|
def list(name = nil, options = {}, &block)
|
@@ -237,7 +237,7 @@ class Renderer
|
|
237
237
|
)
|
238
238
|
end
|
239
239
|
|
240
|
-
print_indented "* #{s}"
|
240
|
+
print_indented "* #{Machinery.scrub(s)}"
|
241
241
|
|
242
242
|
if block_given?
|
243
243
|
@stack << :item
|
@@ -23,7 +23,7 @@ module ScopeFileAccessArchive
|
|
23
23
|
|
24
24
|
target = File.join(destination, "trees")
|
25
25
|
self.select(&:directory?).each do |system_file|
|
26
|
-
raise Machinery::Errors::FileUtilsError
|
26
|
+
raise Machinery::Errors::FileUtilsError unless system_file.directory?
|
27
27
|
|
28
28
|
tarball_target = File.join(target, File.dirname(system_file.name))
|
29
29
|
|
@@ -56,7 +56,7 @@ module ScopeFileAccessArchive
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def file_content(system_file)
|
59
|
-
|
59
|
+
unless extracted
|
60
60
|
raise Machinery::Errors::FileUtilsError, "The requested file '#{system_file.name}' is not" \
|
61
61
|
" available because files for scope '#{scope_name}' were not extracted."
|
62
62
|
end
|
@@ -4,7 +4,7 @@ module ScopeFileAccessFlat
|
|
4
4
|
end
|
5
5
|
|
6
6
|
def write_file(system_file, target)
|
7
|
-
raise Machinery::Errors::FileUtilsError, "Not a file"
|
7
|
+
raise Machinery::Errors::FileUtilsError, "Not a file" unless system_file.file?
|
8
8
|
|
9
9
|
target_path = File.join(target, system_file.name)
|
10
10
|
FileUtils.mkdir_p(File.dirname(target_path))
|
@@ -12,13 +12,13 @@ module ScopeFileAccessFlat
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def file_path(system_file)
|
15
|
-
raise Machinery::Errors::FileUtilsError, "Not a file"
|
15
|
+
raise Machinery::Errors::FileUtilsError, "Not a file" unless system_file.file?
|
16
16
|
|
17
17
|
File.join(scope_file_store.path, system_file.name)
|
18
18
|
end
|
19
19
|
|
20
20
|
def file_content(system_file)
|
21
|
-
|
21
|
+
unless extracted
|
22
22
|
raise Machinery::Errors::FileUtilsError, "The requested file '#{system_file.name}' is" \
|
23
23
|
" not available because files for scope '#{scope_name}' were not extracted."
|
24
24
|
end
|
data/lib/scope_file_store.rb
CHANGED
@@ -33,7 +33,7 @@ class ScopeFileStore
|
|
33
33
|
|
34
34
|
def path
|
35
35
|
dir = File.join(base_path, store_name)
|
36
|
-
Dir.
|
36
|
+
Dir.exist?(dir) ? dir : nil
|
37
37
|
end
|
38
38
|
|
39
39
|
def remove
|
@@ -60,14 +60,14 @@ class ScopeFileStore
|
|
60
60
|
|
61
61
|
def new_dir_mode
|
62
62
|
mode = 0700
|
63
|
-
if Dir.
|
63
|
+
if Dir.exist?(base_path)
|
64
64
|
mode = File.stat(base_path).mode & 0777
|
65
65
|
end
|
66
66
|
mode
|
67
67
|
end
|
68
68
|
|
69
69
|
def create_dir(dir, mode = 0700)
|
70
|
-
unless Dir.
|
70
|
+
unless Dir.exist?(dir)
|
71
71
|
FileUtils.mkdir_p(dir, mode: mode)
|
72
72
|
end
|
73
73
|
end
|