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/compare_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 CompareTask
|
18
|
+
class Machinery::CompareTask
|
19
19
|
def compare(description1, description2, scopes, options = {})
|
20
20
|
if options[:show_html]
|
21
21
|
render_html_comparison(description1, description2, scopes, options)
|
@@ -27,7 +27,7 @@ class CompareTask
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def render_html_comparison(description1, description2, scopes, options)
|
30
|
-
LocalSystem.validate_existence_of_command("xdg-open", "xdg-utils")
|
30
|
+
Machinery::LocalSystem.validate_existence_of_command("xdg-open", "xdg-utils")
|
31
31
|
|
32
32
|
url = "http://#{options[:ip]}:#{options[:port]}/compare/" \
|
33
33
|
"#{CGI.escape(description1.name)}/#{CGI.escape(description2.name)}"
|
@@ -39,8 +39,12 @@ Trying to start a web server for serving the comparison result on #{url}.
|
|
39
39
|
The server can be closed with Ctrl+C.
|
40
40
|
EOF
|
41
41
|
|
42
|
-
server = Html.run_server(
|
43
|
-
|
42
|
+
server = Machinery::Html.run_server(
|
43
|
+
description1.store,
|
44
|
+
port: options[:port],
|
45
|
+
ip: options[:ip]
|
46
|
+
) do
|
47
|
+
Machinery::LoggedCheetah.run("xdg-open", url)
|
44
48
|
end
|
45
49
|
|
46
50
|
server.join # Wait until the user cancelled the blocking webserver
|
@@ -53,9 +57,9 @@ EOF
|
|
53
57
|
common_scopes = false
|
54
58
|
scopes.each do |scope|
|
55
59
|
if description1[scope] && description2[scope]
|
56
|
-
comparison = Comparison.compare_scope(description1, description2, scope)
|
60
|
+
comparison = Machinery::Comparison.compare_scope(description1, description2, scope)
|
57
61
|
|
58
|
-
output += Renderer.for(scope).render_comparison(comparison, options)
|
62
|
+
output += Machinery::Ui::Renderer.for(scope).render_comparison(comparison, options)
|
59
63
|
|
60
64
|
if comparison.only_in1 || comparison.only_in2 || comparison.changed
|
61
65
|
identical = false
|
@@ -64,7 +68,7 @@ EOF
|
|
64
68
|
end
|
65
69
|
common_scopes = true
|
66
70
|
else
|
67
|
-
output += Renderer.for(scope).render_comparison_missing_scope(
|
71
|
+
output += Machinery::Ui::Renderer.for(scope).render_comparison_missing_scope(
|
68
72
|
description1, description2
|
69
73
|
)
|
70
74
|
identical = false if description1[scope] || description2[scope]
|
data/lib/comparison.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 Comparison
|
18
|
+
class Machinery::Comparison
|
19
19
|
attr_accessor :name1, :name2, :only_in1, :only_in2, :changed, :common, :store, :scope
|
20
20
|
|
21
21
|
def self.compare_scope(description1, description2, scope)
|
@@ -52,7 +52,7 @@ class Comparison
|
|
52
52
|
raise "'which' has to be :one, :two or :common"
|
53
53
|
end
|
54
54
|
|
55
|
-
SystemDescription.new(name, store, scope => data)
|
55
|
+
Machinery::SystemDescription.new(name, store, scope => data)
|
56
56
|
end
|
57
57
|
|
58
58
|
def as_json
|
data/lib/config_base.rb
CHANGED
data/lib/config_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 ConfigTask
|
18
|
+
class Machinery::ConfigTask
|
19
19
|
def initialize(config = Machinery::Config.new)
|
20
20
|
@config = config
|
21
21
|
end
|
data/lib/containerize_task.rb
CHANGED
@@ -15,11 +15,11 @@
|
|
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 ContainerizeTask
|
18
|
+
class Machinery::ContainerizeTask
|
19
19
|
def containerize(description, dir)
|
20
20
|
output_path = File.join(dir, description.name)
|
21
21
|
|
22
|
-
mapper = WorkloadMapper.new
|
22
|
+
mapper = Machinery::WorkloadMapper.new
|
23
23
|
workloads = mapper.identify_workloads(description)
|
24
24
|
|
25
25
|
if workloads.empty?
|
@@ -48,7 +48,7 @@ class ContainerizeTask
|
|
48
48
|
private
|
49
49
|
|
50
50
|
def copy_workload_setup_files(description, workloads, services, path)
|
51
|
-
app = ContainerizedApp.new(description.name, workloads, services)
|
51
|
+
app = Machinery::ContainerizedApp.new(description.name, workloads, services)
|
52
52
|
workloads.each do |workload, _|
|
53
53
|
Dir[File.join(Machinery::ROOT, "workload_mapper", workload, "setup", "*.erb")].each do |file|
|
54
54
|
setup_script = ERB.new(File.read(file))
|
data/lib/containerized_app.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
#
|
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
|
-
class ContainerizedApp
|
17
|
+
class Machinery::ContainerizedApp
|
18
18
|
def initialize(name, workloads, services)
|
19
19
|
@name = name
|
20
20
|
@services = services
|
data/lib/copy_task.rb
CHANGED
data/lib/current_user.rb
CHANGED
data/lib/deploy_task.rb
CHANGED
@@ -15,10 +15,12 @@
|
|
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 DeployTask
|
18
|
+
class Machinery::DeployTask
|
19
19
|
def deploy(description, cloud_config, options = {})
|
20
|
-
LocalSystem.validate_architecture("x86_64")
|
21
|
-
LocalSystem.validate_existence_of_packages(
|
20
|
+
Machinery::LocalSystem.validate_architecture("x86_64")
|
21
|
+
Machinery::LocalSystem.validate_existence_of_packages(
|
22
|
+
["python-glanceclient", "kiwi", "kiwi-desc-vmxboot"]
|
23
|
+
)
|
22
24
|
description.validate_build_compatibility
|
23
25
|
|
24
26
|
unless File.exist?(cloud_config)
|
@@ -37,7 +39,7 @@ class DeployTask
|
|
37
39
|
else
|
38
40
|
image_dir = Dir.mktmpdir("#{description.name}-image", "/tmp")
|
39
41
|
is_temporary = true
|
40
|
-
task = BuildTask.new
|
42
|
+
task = Machinery::BuildTask.new
|
41
43
|
task.build(description, image_dir)
|
42
44
|
end
|
43
45
|
|
data/lib/diff_widget.rb
CHANGED
@@ -1,73 +1,77 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
1
|
+
module Machinery
|
2
|
+
class Ui
|
3
|
+
class DiffWidget
|
4
|
+
def initialize(diff_text)
|
5
|
+
diff = Machinery.scrub(diff_text)
|
6
|
+
@lines = diff.lines[2..-1]
|
7
|
+
@widget = {
|
8
|
+
file: diff[/--- a(.*)/, 1],
|
9
|
+
additions: @lines.select { |l| l.start_with?("+") }.length,
|
10
|
+
deletions: @lines.select { |l| l.start_with?("-") }.length
|
11
|
+
}
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
def widget
|
16
|
-
@widget[:lines] = @lines.map do |line|
|
17
|
-
line = ERB::Util.html_escape(line.chomp).gsub("\\", "\").gsub("\t", " " * 8)
|
18
|
-
case line
|
19
|
-
when /^@.*/
|
20
|
-
entry = header_entry(line)
|
21
|
-
@original_line_number = line[/-(\d+)/, 1].to_i
|
22
|
-
@new_line_number = line[/\+(\d+)/, 1].to_i
|
23
|
-
when /^ .*/, ""
|
24
|
-
entry = common_entry(line)
|
25
|
-
@new_line_number += 1
|
26
|
-
@original_line_number += 1
|
27
|
-
when /^\+.*/
|
28
|
-
entry = addition_entry(line)
|
29
|
-
@new_line_number += 1
|
30
|
-
when /^\-.*/
|
31
|
-
entry = deletion_entry(line)
|
32
|
-
@original_line_number += 1
|
13
|
+
@original_line_number = 0
|
14
|
+
@new_line_number = 0
|
33
15
|
end
|
34
16
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
17
|
+
def widget
|
18
|
+
@widget[:lines] = @lines.map do |line|
|
19
|
+
line = ERB::Util.html_escape(line.chomp).gsub("\\", "\").gsub("\t", " " * 8)
|
20
|
+
case line
|
21
|
+
when /^@.*/
|
22
|
+
entry = header_entry(line)
|
23
|
+
@original_line_number = line[/-(\d+)/, 1].to_i
|
24
|
+
@new_line_number = line[/\+(\d+)/, 1].to_i
|
25
|
+
when /^ .*/, ""
|
26
|
+
entry = common_entry(line)
|
27
|
+
@new_line_number += 1
|
28
|
+
@original_line_number += 1
|
29
|
+
when /^\+.*/
|
30
|
+
entry = addition_entry(line)
|
31
|
+
@new_line_number += 1
|
32
|
+
when /^\-.*/
|
33
|
+
entry = deletion_entry(line)
|
34
|
+
@original_line_number += 1
|
35
|
+
end
|
39
36
|
|
40
|
-
|
37
|
+
entry
|
38
|
+
end
|
39
|
+
@widget
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
{
|
44
|
-
type: "header",
|
45
|
-
content: line
|
46
|
-
}
|
47
|
-
end
|
42
|
+
private
|
48
43
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
}
|
56
|
-
end
|
44
|
+
def header_entry(line)
|
45
|
+
{
|
46
|
+
type: "header",
|
47
|
+
content: line
|
48
|
+
}
|
49
|
+
end
|
57
50
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
51
|
+
def common_entry(line)
|
52
|
+
{
|
53
|
+
type: "common",
|
54
|
+
new_line_number: @new_line_number,
|
55
|
+
original_line_number: @original_line_number,
|
56
|
+
content: line[1..-1]
|
57
|
+
}
|
58
|
+
end
|
65
59
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
60
|
+
def addition_entry(line)
|
61
|
+
{
|
62
|
+
type: "addition",
|
63
|
+
new_line_number: @new_line_number,
|
64
|
+
content: line[1..-1]
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
68
|
+
def deletion_entry(line)
|
69
|
+
{
|
70
|
+
type: "deletion",
|
71
|
+
original_line_number: @original_line_number,
|
72
|
+
content: line[1..-1]
|
73
|
+
}
|
74
|
+
end
|
75
|
+
end
|
72
76
|
end
|
73
77
|
end
|
data/lib/docker_system.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 DockerSystem < System
|
18
|
+
class Machinery::DockerSystem < Machinery::System
|
19
19
|
attr_accessor :image
|
20
20
|
|
21
21
|
def type
|
@@ -29,19 +29,21 @@ class DockerSystem < System
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def start
|
32
|
-
@container = LoggedCheetah.run(
|
32
|
+
@container = Machinery::LoggedCheetah.run(
|
33
|
+
"docker", "run", "-id", @image, "bash", stdout: :capture
|
34
|
+
).chomp
|
33
35
|
rescue Cheetah::ExecutionFailed => e
|
34
36
|
raise Machinery::Errors::MachineryError, "Container could not be started." \
|
35
37
|
" The error message was:\n" + e.stderr
|
36
38
|
end
|
37
39
|
|
38
40
|
def stop
|
39
|
-
LoggedCheetah.run("docker", "rm", "-f", @container) if @container
|
41
|
+
Machinery::LoggedCheetah.run("docker", "rm", "-f", @container) if @container
|
40
42
|
end
|
41
43
|
|
42
44
|
def run_command(*args)
|
43
45
|
Machinery.logger.info("Running '#{args}'")
|
44
|
-
LoggedCheetah.run("docker", "exec", "--user=root", "-i", @container, *args)
|
46
|
+
Machinery::LoggedCheetah.run("docker", "exec", "--user=root", "-i", @container, *args)
|
45
47
|
end
|
46
48
|
|
47
49
|
def check_retrieve_files_dependencies
|
@@ -76,7 +78,7 @@ class DockerSystem < System
|
|
76
78
|
|
77
79
|
# Copies a file to the system
|
78
80
|
def inject_file(source, destination)
|
79
|
-
LoggedCheetah.run("docker", "cp", source, "#{@container}:#{destination}")
|
81
|
+
Machinery::LoggedCheetah.run("docker", "cp", source, "#{@container}:#{destination}")
|
80
82
|
end
|
81
83
|
|
82
84
|
# Retrieves files specified in file_list from the container
|
@@ -85,8 +87,10 @@ class DockerSystem < System
|
|
85
87
|
destination_path = File.join(destination, file)
|
86
88
|
FileUtils.mkdir_p(File.dirname(destination_path), mode: 0700)
|
87
89
|
|
88
|
-
LoggedCheetah.run(
|
89
|
-
|
90
|
+
Machinery::LoggedCheetah.run(
|
91
|
+
"docker", "cp", "#{@container}:#{file}", destination_path.to_s
|
92
|
+
)
|
93
|
+
Machinery::LoggedCheetah.run("chmod", "go-rwx", destination_path)
|
90
94
|
end
|
91
95
|
end
|
92
96
|
|
@@ -123,7 +127,7 @@ class DockerSystem < System
|
|
123
127
|
private
|
124
128
|
|
125
129
|
def validate_image_name(image)
|
126
|
-
LoggedCheetah.run("docker", "inspect", image)
|
130
|
+
Machinery::LoggedCheetah.run("docker", "inspect", image)
|
127
131
|
rescue
|
128
132
|
raise Machinery::Errors::InspectionFailed.new("Unknown docker image: '#{image}'")
|
129
133
|
end
|
data/lib/dpkg_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 DpkgDatabase < ManagedFilesDatabase
|
18
|
+
class Machinery::DpkgDatabase < Machinery::ManagedFilesDatabase
|
19
19
|
def managed_files_list(&block)
|
20
20
|
message = "The list of changed config and managed files is not complete on dpkg systems."\
|
21
21
|
" The reason for this is missing verification data:" \
|
data/lib/element_filter.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 ElementFilter
|
18
|
+
class Machinery::ElementFilter
|
19
19
|
attr_accessor :path, :matchers
|
20
20
|
|
21
21
|
def initialize(path, operator = nil, matchers = nil)
|
@@ -34,7 +34,10 @@ class ElementFilter
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def add_matchers(operator, matchers)
|
37
|
-
unless [
|
37
|
+
unless [
|
38
|
+
Machinery::Filter::OPERATOR_EQUALS,
|
39
|
+
Machinery::Filter::OPERATOR_EQUALS_NOT
|
40
|
+
].include?(operator)
|
38
41
|
raise Machinery::Errors::InvalidFilter.new("Wrong filter operator '#{operator}'")
|
39
42
|
end
|
40
43
|
|
@@ -66,9 +69,9 @@ class ElementFilter
|
|
66
69
|
value == matcher
|
67
70
|
end
|
68
71
|
end
|
69
|
-
if operator == Filter::OPERATOR_EQUALS
|
72
|
+
if operator == Machinery::Filter::OPERATOR_EQUALS
|
70
73
|
return true if values_equal
|
71
|
-
elsif operator == Filter::OPERATOR_EQUALS_NOT
|
74
|
+
elsif operator == Machinery::Filter::OPERATOR_EQUALS_NOT
|
72
75
|
return true unless values_equal
|
73
76
|
end
|
74
77
|
end
|
data/lib/exceptions.rb
CHANGED
@@ -28,7 +28,12 @@ module Machinery
|
|
28
28
|
class MachineryError < StandardError; end
|
29
29
|
|
30
30
|
class UnknownScope < MachineryError; end
|
31
|
-
class UnknownOs < MachineryError
|
31
|
+
class UnknownOs < MachineryError
|
32
|
+
def to_s
|
33
|
+
"Unable to determine the operating system. There does not seem to be an" \
|
34
|
+
" /etc/os-release file."
|
35
|
+
end
|
36
|
+
end
|
32
37
|
class InvalidPager < MachineryError; end
|
33
38
|
class InvalidCommandLine < MachineryError; end
|
34
39
|
|
@@ -49,8 +54,9 @@ module Machinery
|
|
49
54
|
if !@format_version
|
50
55
|
"#{@name}: incompatible format version. Can not be upgraded."
|
51
56
|
elsif @format_version < SystemDescription::CURRENT_FORMAT_VERSION
|
52
|
-
"#{@name}: format version #{@format_version}, needs to be upgraded. "
|
53
|
-
"Try '#{Hint.program_name} upgrade-format #{name}'
|
57
|
+
"#{@name}: format version #{@format_version}, needs to be upgraded. "\
|
58
|
+
"Try '#{Ui::Hint.program_name} upgrade-format #{name}'"\
|
59
|
+
" to upgrade it to the current version."
|
54
60
|
else
|
55
61
|
"#{@name}: format version #{@format_version}. " \
|
56
62
|
"Please upgrade Machinery to the latest version."
|
@@ -76,7 +82,7 @@ module Machinery
|
|
76
82
|
inspect_cmd = "inspect"
|
77
83
|
end
|
78
84
|
|
79
|
-
cmd = "#{Hint.program_name} #{inspect_cmd} --extract-files " \
|
85
|
+
cmd = "#{Ui::Hint.program_name} #{inspect_cmd} --extract-files " \
|
80
86
|
"--scope=#{formatted_scopes.delete(" ")}"
|
81
87
|
cmd += " --name='#{@description.name}'" if hostname != @description.name
|
82
88
|
cmd += " #{hostname}"
|
@@ -124,6 +130,18 @@ module Machinery
|
|
124
130
|
end
|
125
131
|
end
|
126
132
|
|
133
|
+
class CommandFailed < MachineryError
|
134
|
+
def initialize(command, error)
|
135
|
+
@command = command
|
136
|
+
@error = error
|
137
|
+
end
|
138
|
+
|
139
|
+
def to_s
|
140
|
+
"The required call '#{@command}' does not seem to work as expected on the" \
|
141
|
+
" inspected system. This is the error message:\n#{@error}"
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
127
145
|
class SudoMissingTTY < MachineryError
|
128
146
|
def initialize(host)
|
129
147
|
@host = host
|
@@ -131,7 +149,7 @@ module Machinery
|
|
131
149
|
|
132
150
|
def to_s
|
133
151
|
"'sudo' isn't configured on the inspected host '#{@host}'." \
|
134
|
-
" Remove the
|
152
|
+
" Remove the 'requiretty' settings from /etc/sudoers by running `visudo`."
|
135
153
|
end
|
136
154
|
end
|
137
155
|
|