machinery-tool 1.22.1 → 1.22.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.git_revision +1 -1
- data/NEWS +10 -0
- data/bin/machinery +1 -1
- data/lib/analyze_changed_config_files_diffs_task.rb +6 -6
- data/lib/autoyast.rb +2 -2
- data/lib/build_task.rb +10 -7
- data/lib/cli.rb +1005 -801
- data/lib/compare_task.rb +11 -7
- data/lib/comparison.rb +2 -2
- data/lib/config_base.rb +1 -1
- data/lib/config_task.rb +1 -1
- data/lib/containerize_task.rb +3 -3
- data/lib/containerized_app.rb +1 -1
- data/lib/copy_task.rb +1 -1
- data/lib/current_user.rb +1 -1
- data/lib/deploy_task.rb +6 -4
- data/lib/diff_widget.rb +67 -63
- data/lib/docker_system.rb +12 -8
- data/lib/dpkg_database.rb +1 -1
- data/lib/element_filter.rb +7 -4
- data/lib/exceptions.rb +23 -5
- data/lib/export_task.rb +1 -1
- data/lib/exporter.rb +1 -1
- data/lib/file_diff.rb +1 -1
- data/lib/file_scope.rb +1 -1
- data/lib/file_validator.rb +7 -4
- data/lib/filter.rb +97 -93
- data/lib/filter_option_parser.rb +2 -2
- data/lib/hint.rb +64 -59
- data/lib/html.rb +1 -1
- data/lib/inspect_task.rb +12 -12
- data/lib/inspector.rb +3 -3
- data/lib/json_validation_error_cleaner.rb +1 -1
- data/lib/json_validator.rb +4 -4
- data/lib/kiwi_config.rb +8 -4
- data/lib/list_task.rb +10 -9
- data/lib/local_system.rb +11 -5
- data/lib/logged_cheetah.rb +1 -1
- data/lib/man_task.rb +10 -6
- data/lib/managed_files_database.rb +1 -1
- data/lib/manifest.rb +5 -5
- data/lib/migration.rb +16 -10
- data/lib/mountpoints.rb +1 -1
- data/lib/move_task.rb +1 -1
- data/lib/remote_system.rb +7 -7
- data/lib/remove_task.rb +1 -1
- data/lib/renderer.rb +177 -172
- data/lib/rpm.rb +4 -4
- data/lib/rpm_database.rb +1 -1
- data/lib/scope.rb +2 -2
- data/lib/scope_file_access_archive.rb +1 -1
- data/lib/scope_file_access_flat.rb +1 -1
- data/lib/scope_file_store.rb +1 -1
- data/lib/serve_html_task.rb +6 -2
- data/lib/server.rb +19 -12
- data/lib/show_task.rb +10 -6
- data/lib/static_html.rb +1 -1
- data/lib/system.rb +10 -10
- data/lib/system_description.rb +14 -13
- data/lib/system_description_memory_store.rb +1 -1
- data/lib/system_description_store.rb +9 -9
- data/lib/tarball.rb +8 -2
- data/lib/upgrade_format_task.rb +11 -6
- data/lib/validate_task.rb +2 -2
- data/lib/version.rb +1 -1
- data/lib/workload_mapper.rb +2 -2
- data/lib/workload_mapper_dsl.rb +1 -1
- data/lib/zypper.rb +40 -17
- data/machinery-helper/machinery_helper.go +35 -16
- data/machinery-helper/version.go +1 -1
- data/man/generated/machinery.1.gz +0 -0
- data/manual/site/sitemap.xml +24 -24
- data/plugins/changed_config_files/changed_config_files_inspector.rb +59 -56
- data/plugins/changed_config_files/changed_config_files_model.rb +23 -21
- data/plugins/changed_config_files/changed_config_files_renderer.rb +56 -52
- data/plugins/changed_managed_files/changed_managed_files_inspector.rb +52 -50
- data/plugins/changed_managed_files/changed_managed_files_model.rb +23 -21
- data/plugins/changed_managed_files/changed_managed_files_renderer.rb +43 -39
- data/plugins/environment/environment_inspector.rb +25 -23
- data/plugins/environment/environment_model.rb +5 -3
- data/plugins/groups/groups_inspector.rb +30 -28
- data/plugins/groups/groups_model.rb +18 -17
- data/plugins/groups/groups_renderer.rb +29 -25
- data/plugins/os/os_inspector.rb +120 -118
- data/plugins/os/os_model.rb +139 -134
- data/plugins/os/os_renderer.rb +13 -9
- data/plugins/packages/packages_inspector.rb +99 -86
- data/plugins/packages/packages_model.rb +35 -34
- data/plugins/packages/packages_renderer.rb +47 -39
- data/plugins/patterns/patterns_inspector.rb +70 -68
- data/plugins/patterns/patterns_model.rb +19 -18
- data/plugins/patterns/patterns_renderer.rb +36 -32
- data/plugins/repositories/repositories_inspector.rb +162 -156
- data/plugins/repositories/repositories_model.rb +50 -49
- data/plugins/repositories/repositories_renderer.rb +48 -44
- data/plugins/repositories/schema/system-description-repositories.schema-v10.json +0 -1
- data/plugins/services/services_inspector.rb +187 -176
- data/plugins/services/services_model.rb +37 -36
- data/plugins/services/services_renderer.rb +28 -24
- data/plugins/unmanaged_files/unmanaged_files_inspector.rb +102 -99
- data/plugins/unmanaged_files/unmanaged_files_model.rb +64 -56
- data/plugins/unmanaged_files/unmanaged_files_renderer.rb +44 -40
- data/plugins/users/users_inspector.rb +67 -65
- data/plugins/users/users_model.rb +37 -36
- data/plugins/users/users_renderer.rb +31 -27
- data/schema/migrations/migrate1to2.rb +1 -1
- data/schema/migrations/migrate2to3.rb +1 -1
- data/schema/migrations/migrate3to4.rb +1 -1
- data/schema/migrations/migrate4to5.rb +1 -1
- data/schema/migrations/migrate5to6.rb +1 -1
- data/schema/migrations/migrate6to7.rb +1 -1
- data/schema/migrations/migrate7to8.rb +1 -1
- data/schema/migrations/migrate8to9.rb +1 -1
- data/schema/migrations/migrate9to10.rb +1 -1
- metadata +2 -2
data/lib/rpm.rb
CHANGED
@@ -16,15 +16,15 @@
|
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
18
|
# Rpm represents an RPM package on the disk.
|
19
|
-
class Rpm
|
19
|
+
class Machinery::Rpm
|
20
20
|
def initialize(path)
|
21
21
|
@path = path
|
22
22
|
end
|
23
23
|
|
24
24
|
def diff(file, local_file)
|
25
25
|
begin
|
26
|
-
cpio = LoggedCheetah.run("rpm2cpio", @path, stdout: :capture)
|
27
|
-
original_config = LoggedCheetah.run(
|
26
|
+
cpio = Machinery::LoggedCheetah.run("rpm2cpio", @path, stdout: :capture)
|
27
|
+
original_config = Machinery::LoggedCheetah.run(
|
28
28
|
"cpio", "-iv", "--to-stdout", ".#{file}", stdin: cpio, stdout: :capture
|
29
29
|
)
|
30
30
|
rescue Cheetah::ExecutionFailed => e
|
@@ -33,7 +33,7 @@ class Rpm
|
|
33
33
|
end
|
34
34
|
|
35
35
|
begin
|
36
|
-
LoggedCheetah.run(
|
36
|
+
Machinery::LoggedCheetah.run(
|
37
37
|
"diff", "-u", "--label", "#{File.join("a", file)}", "--from-file=-",
|
38
38
|
"--label", "#{File.join("b", file)}", local_file,
|
39
39
|
stdin: original_config,
|
data/lib/rpm_database.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# To contact SUSE about this file by physical or electronic mail,
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
|
-
class RpmDatabase < ManagedFilesDatabase
|
18
|
+
class Machinery::RpmDatabase < Machinery::ManagedFilesDatabase
|
19
19
|
def managed_files_list(&block)
|
20
20
|
@system.run_script_with_progress("changed_files.sh", &block)
|
21
21
|
end
|
data/lib/scope.rb
CHANGED
@@ -72,7 +72,7 @@ module Machinery
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def scope_name
|
75
|
-
scope = name.match(/^(.*)Scope$/)[1]
|
75
|
+
scope = name.match(/^Machinery::(.*)Scope$/)[1]
|
76
76
|
scope.gsub(/([^A-Z])([A-Z])/, "\\1_\\2").downcase
|
77
77
|
end
|
78
78
|
end
|
@@ -92,7 +92,7 @@ module Machinery
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def is_extractable?
|
95
|
-
SystemDescription::EXTRACTABLE_SCOPES.include?(
|
95
|
+
Machinery::SystemDescription::EXTRACTABLE_SCOPES.include?(scope_name)
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
data/lib/scope_file_store.rb
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
# The responsibility of the ScopeFileStore class is to represent a sub directory
|
19
19
|
# of a system description which is used to hold files belonging to a specific
|
20
20
|
# scope.
|
21
|
-
class ScopeFileStore
|
21
|
+
class Machinery::ScopeFileStore
|
22
22
|
attr_accessor :base_path, :store_name
|
23
23
|
|
24
24
|
def initialize(base_path, store_name)
|
data/lib/serve_html_task.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
# To contact SUSE about this file by physical or electronic mail,
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
|
-
class ServeHtmlTask
|
18
|
+
class Machinery::ServeHtmlTask
|
19
19
|
def assemble_url(opts)
|
20
20
|
host = if !opts[:public]
|
21
21
|
"127.0.0.1"
|
@@ -46,7 +46,11 @@ A specific description with the name NAME is accessible at:
|
|
46
46
|
The web server can be closed with Ctrl+C.
|
47
47
|
EOF
|
48
48
|
|
49
|
-
server = Html.run_server(
|
49
|
+
server = Machinery::Html.run_server(
|
50
|
+
system_description_store,
|
51
|
+
port: opts[:port],
|
52
|
+
public: opts[:public]
|
53
|
+
)
|
50
54
|
|
51
55
|
server.join
|
52
56
|
end
|
data/lib/server.rb
CHANGED
@@ -111,7 +111,8 @@ class Server < Sinatra::Base
|
|
111
111
|
changed.push(
|
112
112
|
id: change[0][opts[:key]],
|
113
113
|
change: "(" + changes.join(", ") + ")",
|
114
|
-
diffable: change[0].is_a?(UnmanagedFile) &&
|
114
|
+
diffable: change[0].is_a?(Machinery::UnmanagedFile) &&
|
115
|
+
change[0].is_a?(Machinery::UnmanagedFile) &&
|
115
116
|
change[0].file? && change[1].file? &&
|
116
117
|
@diff[scope].try(:common).try(:attributes).try(:[], "extracted")
|
117
118
|
)
|
@@ -142,7 +143,7 @@ class Server < Sinatra::Base
|
|
142
143
|
enable :sessions
|
143
144
|
|
144
145
|
get "/descriptions/:id/files/:scope/*" do
|
145
|
-
description = SystemDescription.load(params[:id], settings.system_description_store)
|
146
|
+
description = Machinery::SystemDescription.load(params[:id], settings.system_description_store)
|
146
147
|
filename = File.join("/", params["splat"].first)
|
147
148
|
|
148
149
|
file = description[params[:scope]].find { |f| f.name == filename }
|
@@ -169,7 +170,7 @@ class Server < Sinatra::Base
|
|
169
170
|
descriptions.each do |name|
|
170
171
|
scopes = []
|
171
172
|
begin
|
172
|
-
system_description = SystemDescription.load(
|
173
|
+
system_description = Machinery::SystemDescription.load(
|
173
174
|
name, settings.system_description_store, skip_validation: true
|
174
175
|
)
|
175
176
|
@all_descriptions[name] = Hash.new
|
@@ -177,7 +178,7 @@ class Server < Sinatra::Base
|
|
177
178
|
@all_descriptions[name]["host"] = system_description.host
|
178
179
|
system_description.scopes.each do |scope|
|
179
180
|
entry = Machinery::Ui.internal_scope_list_to_string(scope)
|
180
|
-
if SystemDescription::EXTRACTABLE_SCOPES.include?(scope)
|
181
|
+
if Machinery::SystemDescription::EXTRACTABLE_SCOPES.include?(scope)
|
181
182
|
if system_description.scope_extracted?(scope)
|
182
183
|
entry += " (extracted)"
|
183
184
|
else
|
@@ -208,15 +209,19 @@ class Server < Sinatra::Base
|
|
208
209
|
get "/compare/:a/:b" do
|
209
210
|
all_descriptions
|
210
211
|
|
211
|
-
@description_a = SystemDescription.load(
|
212
|
-
|
212
|
+
@description_a = Machinery::SystemDescription.load(
|
213
|
+
params[:a], settings.system_description_store
|
214
|
+
)
|
215
|
+
@description_b = Machinery::SystemDescription.load(
|
216
|
+
params[:b], settings.system_description_store
|
217
|
+
)
|
213
218
|
|
214
219
|
@meta = {}
|
215
220
|
@diff = {}
|
216
221
|
|
217
|
-
Inspector.all_scopes.each do |scope|
|
222
|
+
Machinery::Inspector.all_scopes.each do |scope|
|
218
223
|
if @description_a[scope] && @description_b[scope]
|
219
|
-
@diff[scope] = Comparison.compare_scope(@description_a, @description_b, scope)
|
224
|
+
@diff[scope] = Machinery::Comparison.compare_scope(@description_a, @description_b, scope)
|
220
225
|
elsif @description_a[scope] || @description_b[scope]
|
221
226
|
@meta[:uninspected] ||= Hash.new
|
222
227
|
|
@@ -235,12 +240,12 @@ class Server < Sinatra::Base
|
|
235
240
|
end
|
236
241
|
|
237
242
|
get "/compare/:a/:b/files/:scope/*" do
|
238
|
-
description1 = SystemDescription.load(params[:a], settings.system_description_store)
|
239
|
-
description2 = SystemDescription.load(params[:b], settings.system_description_store)
|
243
|
+
description1 = Machinery::SystemDescription.load(params[:a], settings.system_description_store)
|
244
|
+
description2 = Machinery::SystemDescription.load(params[:b], settings.system_description_store)
|
240
245
|
filename = File.join("/", params["splat"].first)
|
241
246
|
|
242
247
|
begin
|
243
|
-
diff = FileDiff.diff(description1, description2, params[:scope], filename)
|
248
|
+
diff = Machinery::FileDiff.diff(description1, description2, params[:scope], filename)
|
244
249
|
rescue Machinery::Errors::BinaryDiffError
|
245
250
|
status 406
|
246
251
|
return "binary file"
|
@@ -253,7 +258,9 @@ class Server < Sinatra::Base
|
|
253
258
|
all_descriptions
|
254
259
|
|
255
260
|
begin
|
256
|
-
@description = SystemDescription.load(
|
261
|
+
@description = Machinery::SystemDescription.load(
|
262
|
+
params[:id], settings.system_description_store
|
263
|
+
)
|
257
264
|
rescue Machinery::Errors::SystemDescriptionNotFound => e
|
258
265
|
session[:error] = e.to_s
|
259
266
|
redirect "/"
|
data/lib/show_task.rb
CHANGED
@@ -15,9 +15,9 @@
|
|
15
15
|
# To contact SUSE about this file by physical or electronic mail,
|
16
16
|
# you may find current contact information at www.suse.com
|
17
17
|
|
18
|
-
class ShowTask
|
18
|
+
class Machinery::ShowTask
|
19
19
|
def show(description, scopes, filter, options = {})
|
20
|
-
scopes = Inspector.sort_scopes(scopes)
|
20
|
+
scopes = Machinery::Inspector.sort_scopes(scopes)
|
21
21
|
if options[:show_html]
|
22
22
|
show_html(description, options)
|
23
23
|
else
|
@@ -30,7 +30,7 @@ class ShowTask
|
|
30
30
|
|
31
31
|
def show_html(description, options)
|
32
32
|
begin
|
33
|
-
LocalSystem.validate_existence_of_command("xdg-open", "xdg-utils")
|
33
|
+
Machinery::LocalSystem.validate_existence_of_command("xdg-open", "xdg-utils")
|
34
34
|
|
35
35
|
url = "http://#{options[:ip]}:#{options[:port]}/#{CGI.escape(description.name)}"
|
36
36
|
|
@@ -41,8 +41,12 @@ Trying to start a web server for serving the description on #{url}.
|
|
41
41
|
The server can be closed with Ctrl+C.
|
42
42
|
EOF
|
43
43
|
|
44
|
-
server = Html.run_server(
|
45
|
-
|
44
|
+
server = Machinery::Html.run_server(
|
45
|
+
description.store,
|
46
|
+
port: options[:port],
|
47
|
+
ip: options[:ip]
|
48
|
+
) do
|
49
|
+
Machinery::LoggedCheetah.run("xdg-open", url)
|
46
50
|
end
|
47
51
|
|
48
52
|
server.join # Wait until the user cancelled the blocking webserver
|
@@ -57,7 +61,7 @@ EOF
|
|
57
61
|
def show_console(description, scopes, options)
|
58
62
|
missing_scopes = []
|
59
63
|
|
60
|
-
scopes.map { |s| Renderer.for(s) }.each do |renderer|
|
64
|
+
scopes.map { |s| Machinery::Ui::Renderer.for(s) }.each do |renderer|
|
61
65
|
section = renderer.render(description, options)
|
62
66
|
unless section.empty?
|
63
67
|
Machinery::Ui.puts section
|
data/lib/static_html.rb
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
#
|
16
16
|
# To contact SUSE about this file by physical or electronic mail,
|
17
17
|
# you may find current contact information at www.suse.com
|
18
|
-
class StaticHtml < Exporter
|
18
|
+
class Machinery::StaticHtml < Machinery::Exporter
|
19
19
|
TEMPLATE_DIR = File.join(Machinery::ROOT, "html").freeze
|
20
20
|
PARTIAL_DIR = File.join(Machinery::ROOT, "html", "partials").freeze
|
21
21
|
|
data/lib/system.rb
CHANGED
@@ -21,7 +21,7 @@
|
|
21
21
|
# It abstracts common inspection tasks that need to be run, like executing
|
22
22
|
# commands or running "kiwi --describe". Different implementations, e.g. for
|
23
23
|
# local or ssh-accessed systems are done in the according subclasses.
|
24
|
-
class System
|
24
|
+
class Machinery::System
|
25
25
|
abstract_method :requires_root?
|
26
26
|
abstract_method :run_command
|
27
27
|
abstract_method :kiwi_describe
|
@@ -35,9 +35,9 @@ class System
|
|
35
35
|
|
36
36
|
def self.for(host, opts = {})
|
37
37
|
if host && host != "localhost"
|
38
|
-
RemoteSystem.new(host, opts)
|
38
|
+
Machinery::RemoteSystem.new(host, opts)
|
39
39
|
else
|
40
|
-
LocalSystem.new
|
40
|
+
Machinery::LocalSystem.new
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
@@ -52,7 +52,8 @@ class System
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
raise Machinery::Errors::MissingRequirement.new(
|
55
|
-
"Need
|
55
|
+
"Need the '#{commands.join("' or '")}' #{Machinery.pluralize(commands.length, "command")}" \
|
56
|
+
" to be available on the inspected system."
|
56
57
|
)
|
57
58
|
end
|
58
59
|
|
@@ -140,9 +141,9 @@ class System
|
|
140
141
|
if @managed_files_database
|
141
142
|
return @managed_files_database
|
142
143
|
elsif has_command?("rpm")
|
143
|
-
@managed_files_database = RpmDatabase.new(self)
|
144
|
+
@managed_files_database = Machinery::RpmDatabase.new(self)
|
144
145
|
elsif has_command?("dpkg")
|
145
|
-
@managed_files_database = DpkgDatabase.new(self)
|
146
|
+
@managed_files_database = Machinery::DpkgDatabase.new(self)
|
146
147
|
else
|
147
148
|
raise Machinery::Errors::MissingRequirement.new(
|
148
149
|
"Need binary 'rpm' or 'dpkg' to be available on the inspected system."
|
@@ -163,6 +164,7 @@ class System
|
|
163
164
|
options[:stdout] = write_io
|
164
165
|
options[:stderr] = error_io
|
165
166
|
|
167
|
+
Thread.abort_on_exception = true
|
166
168
|
inspect_thread = Thread.new do
|
167
169
|
if type == :script
|
168
170
|
run_script(*command, options)
|
@@ -177,10 +179,8 @@ class System
|
|
177
179
|
callback.call(chunk) if callback
|
178
180
|
end
|
179
181
|
|
180
|
-
if error.include?("password is required")
|
181
|
-
raise Machinery::Errors::InsufficientPrivileges.new(remote_user, host)
|
182
|
-
end
|
183
|
-
|
184
182
|
output
|
183
|
+
rescue
|
184
|
+
raise Machinery::Errors::CommandFailed.new(command.join(" "), error)
|
185
185
|
end
|
186
186
|
end
|
data/lib/system_description.rb
CHANGED
@@ -25,7 +25,7 @@
|
|
25
25
|
#
|
26
26
|
# The sub directories storing the data for specific scopes are handled by the
|
27
27
|
# ScopeFileStore class.
|
28
|
-
class SystemDescription < Machinery::Object
|
28
|
+
class Machinery::SystemDescription < Machinery::Object
|
29
29
|
CURRENT_FORMAT_VERSION = 10
|
30
30
|
EXTRACTABLE_SCOPES = [
|
31
31
|
"changed_managed_files",
|
@@ -43,7 +43,7 @@ class SystemDescription < Machinery::Object
|
|
43
43
|
#
|
44
44
|
# If there are file validation errors the call fails with an exception
|
45
45
|
def load!(name, store, options = {})
|
46
|
-
manifest = Manifest.load(name, store.manifest_path(name))
|
46
|
+
manifest = Machinery::Manifest.load(name, store.manifest_path(name))
|
47
47
|
manifest.validate!
|
48
48
|
|
49
49
|
description = from_hash(name, store, manifest.to_hash)
|
@@ -61,7 +61,7 @@ class SystemDescription < Machinery::Object
|
|
61
61
|
# If there are file validation errors these are put out as warnings but the
|
62
62
|
# loading of the system description succeeds.
|
63
63
|
def load(name, store, options = {})
|
64
|
-
manifest = Manifest.load(name, store.manifest_path(name))
|
64
|
+
manifest = Machinery::Manifest.load(name, store.manifest_path(name))
|
65
65
|
manifest.validate unless options[:skip_validation]
|
66
66
|
|
67
67
|
description = from_hash(name, store, manifest.to_hash)
|
@@ -89,9 +89,10 @@ class SystemDescription < Machinery::Object
|
|
89
89
|
def from_hash(name, store, hash)
|
90
90
|
begin
|
91
91
|
json_format_version = hash["meta"]["format_version"] if hash["meta"]
|
92
|
-
description = SystemDescription.new(name, store, hash)
|
92
|
+
description = Machinery::SystemDescription.new(name, store, hash)
|
93
93
|
rescue NameError, TypeError, RuntimeError
|
94
|
-
if json_format_version &&
|
94
|
+
if json_format_version &&
|
95
|
+
json_format_version != Machinery::SystemDescription::CURRENT_FORMAT_VERSION
|
95
96
|
raise Machinery::Errors::SystemDescriptionIncompatible.new(name, json_format_version)
|
96
97
|
else
|
97
98
|
raise Machinery::Errors::SystemDescriptionError.new(
|
@@ -146,7 +147,7 @@ class SystemDescription < Machinery::Object
|
|
146
147
|
|
147
148
|
def compatible?
|
148
149
|
!format_version.nil? &&
|
149
|
-
format_version == SystemDescription::CURRENT_FORMAT_VERSION
|
150
|
+
format_version == Machinery::SystemDescription::CURRENT_FORMAT_VERSION
|
150
151
|
end
|
151
152
|
|
152
153
|
def validate_format_compatibility
|
@@ -156,7 +157,7 @@ class SystemDescription < Machinery::Object
|
|
156
157
|
end
|
157
158
|
|
158
159
|
def validate_analysis_compatibility
|
159
|
-
Zypper.isolated(arch: os.architecture) do |zypper|
|
160
|
+
Machinery::Zypper.isolated(arch: os.architecture) do |zypper|
|
160
161
|
major, minor, patch = zypper.version
|
161
162
|
if major <= 1 && minor <= 11 && patch < 4
|
162
163
|
raise Machinery::Errors::AnalysisFailed.new("Analyzing command requires zypper 1.11.4 " \
|
@@ -196,7 +197,7 @@ class SystemDescription < Machinery::Object
|
|
196
197
|
end
|
197
198
|
|
198
199
|
def save
|
199
|
-
SystemDescription.validate_name(name)
|
200
|
+
Machinery::SystemDescription.validate_name(name)
|
200
201
|
@store.directory_for(name)
|
201
202
|
path = @store.manifest_path(name)
|
202
203
|
created = !File.exist?(path)
|
@@ -219,7 +220,7 @@ class SystemDescription < Machinery::Object
|
|
219
220
|
end
|
220
221
|
|
221
222
|
def scopes
|
222
|
-
Inspector.sort_scopes(attributes.keys.map(&:to_s).sort)
|
223
|
+
Machinery::Inspector.sort_scopes(attributes.keys.map(&:to_s).sort)
|
223
224
|
end
|
224
225
|
|
225
226
|
def assert_scopes(*scopes)
|
@@ -253,11 +254,11 @@ class SystemDescription < Machinery::Object
|
|
253
254
|
end
|
254
255
|
|
255
256
|
def scope_file_store(store_name)
|
256
|
-
ScopeFileStore.new(description_path, store_name)
|
257
|
+
Machinery::ScopeFileStore.new(description_path, store_name)
|
257
258
|
end
|
258
259
|
|
259
260
|
def validate_file_data
|
260
|
-
errors = FileValidator.new(to_hash, description_path).validate
|
261
|
+
errors = Machinery::FileValidator.new(to_hash, description_path).validate
|
261
262
|
unless errors.empty?
|
262
263
|
Machinery::Ui.warn("Warning: File validation errors:")
|
263
264
|
Machinery::Ui.warn("Error validating description '#{@name}'\n\n")
|
@@ -266,7 +267,7 @@ class SystemDescription < Machinery::Object
|
|
266
267
|
end
|
267
268
|
|
268
269
|
def validate_file_data!
|
269
|
-
errors = FileValidator.new(to_hash, description_path).validate
|
270
|
+
errors = Machinery::FileValidator.new(to_hash, description_path).validate
|
270
271
|
unless errors.empty?
|
271
272
|
e = Machinery::Errors::SystemDescriptionValidationFailed.new(errors)
|
272
273
|
e.header = "Error validating description '#{@name}'"
|
@@ -316,7 +317,7 @@ class SystemDescription < Machinery::Object
|
|
316
317
|
return unless changed_config_files && diffs_dir
|
317
318
|
changed_config_files.each do |file|
|
318
319
|
path = File.join(diffs_dir, file.name + ".diff")
|
319
|
-
file.diff = DiffWidget.new(File.read(path)).widget if File.exist?(path)
|
320
|
+
file.diff = Machinery::Ui::DiffWidget.new(File.read(path)).widget if File.exist?(path)
|
320
321
|
end
|
321
322
|
end
|
322
323
|
|
@@ -21,7 +21,7 @@
|
|
21
21
|
#
|
22
22
|
# System descriptions are represented by sub directories of this top-level
|
23
23
|
# directory. They are handled by the SystemDescription class.
|
24
|
-
class SystemDescriptionStore
|
24
|
+
class Machinery::SystemDescriptionStore
|
25
25
|
attr_reader :base_path
|
26
26
|
|
27
27
|
def default_path
|
@@ -58,7 +58,7 @@ class SystemDescriptionStore
|
|
58
58
|
|
59
59
|
def remove(name)
|
60
60
|
unless name.empty?
|
61
|
-
SystemDescription.validate_name(name)
|
61
|
+
Machinery::SystemDescription.validate_name(name)
|
62
62
|
FileUtils.rm_rf(description_path(name))
|
63
63
|
else
|
64
64
|
raise "The system description has no name specified and thus can't be deleted."
|
@@ -66,8 +66,8 @@ class SystemDescriptionStore
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def copy(from, to)
|
69
|
-
SystemDescription.validate_name(from)
|
70
|
-
SystemDescription.validate_name(to)
|
69
|
+
Machinery::SystemDescription.validate_name(from)
|
70
|
+
Machinery::SystemDescription.validate_name(to)
|
71
71
|
|
72
72
|
validate_existence_of_description(from)
|
73
73
|
validate_nonexistence_of_description(to)
|
@@ -76,8 +76,8 @@ class SystemDescriptionStore
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def move(from, to)
|
79
|
-
SystemDescription.validate_name(from)
|
80
|
-
SystemDescription.validate_name(to)
|
79
|
+
Machinery::SystemDescription.validate_name(from)
|
80
|
+
Machinery::SystemDescription.validate_name(to)
|
81
81
|
|
82
82
|
validate_existence_of_description(from)
|
83
83
|
validate_nonexistence_of_description(to)
|
@@ -86,7 +86,7 @@ class SystemDescriptionStore
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def backup(description_name)
|
89
|
-
SystemDescription.validate_name(description_name)
|
89
|
+
Machinery::SystemDescription.validate_name(description_name)
|
90
90
|
validate_existence_of_description(description_name)
|
91
91
|
|
92
92
|
backup_name = get_backup_name(description_name)
|
@@ -96,8 +96,8 @@ class SystemDescriptionStore
|
|
96
96
|
end
|
97
97
|
|
98
98
|
def rename(from, to)
|
99
|
-
SystemDescription.validate_name(from)
|
100
|
-
SystemDescription.validate_name(to)
|
99
|
+
Machinery::SystemDescription.validate_name(from)
|
100
|
+
Machinery::SystemDescription.validate_name(to)
|
101
101
|
|
102
102
|
validate_existence_of_description(from)
|
103
103
|
validate_nonexistence_of_description(to)
|