machinery-tool 1.9.0 → 1.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS +4 -0
- data/lib/analyze_config_file_diffs_task.rb +6 -0
- data/lib/cli.rb +28 -12
- data/lib/config_base.rb +12 -8
- data/lib/local_system.rb +3 -1
- data/lib/remove_task.rb +2 -2
- data/lib/show_task.rb +1 -1
- data/lib/system_description.rb +3 -3
- data/lib/system_description_store.rb +2 -2
- data/lib/upgrade_format_task.rb +4 -4
- data/lib/version.rb +1 -1
- data/man/generated/machinery.1.gz +0 -0
- data/man/generated/machinery.1.html +7 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8755dd722d4450f406fe08db1700528783ff297
|
4
|
+
data.tar.gz: 3709616bfe0e90ac03543cda9ad942cc60ee8800
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8f9fd19e24aeced39f9c6218461aa35145484b53e99de5961d90a9e8933928538aceb53da569714210a2d5fb1d32b6859a73fb383b6b7db2942c601e468c0a7
|
7
|
+
data.tar.gz: a634e571b90b353f7c3f878ccb9dec19ced958df03d0401d7851226847cf4bbc7ce643b8acd7aebc5bc5c69a7cda5db0f445d1a2e19b5886b5e560db74a6dc60
|
data/NEWS
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Machinery Release Notes
|
2
2
|
|
3
3
|
|
4
|
+
## Version 1.9.1 - Tue Jun 23 16:57:35 CEST 2015 - thardeck@suse.de
|
5
|
+
|
6
|
+
* `machinery config` takes arguments of the form 'key=value' as well
|
7
|
+
|
4
8
|
## Version 1.9.0 - Wed Jun 17 09:57:07 CEST 2015 - thardeck@suse.de
|
5
9
|
|
6
10
|
* Support links in changed managed files scope
|
@@ -23,6 +23,12 @@ class AnalyzeConfigFileDiffsTask
|
|
23
23
|
"repositories",
|
24
24
|
"config_files"
|
25
25
|
)
|
26
|
+
|
27
|
+
if !description["repositories"].any? { |repo| repo.enabled && !repo.external_medium? }
|
28
|
+
raise Machinery::Errors::AnalysisFailed,
|
29
|
+
"Can not analyze the system description because it does not contain any online repository"
|
30
|
+
end
|
31
|
+
|
26
32
|
if !description.scope_extracted?("config_files")
|
27
33
|
raise Machinery::Errors::MissingExtractedFiles.new(description, ["config_files"])
|
28
34
|
end
|
data/lib/cli.rb
CHANGED
@@ -37,7 +37,8 @@ class Cli
|
|
37
37
|
else
|
38
38
|
Machinery.logger.level = Logger::INFO
|
39
39
|
end
|
40
|
-
|
40
|
+
|
41
|
+
validate_number_of_arguments(command.arguments, args)
|
41
42
|
end
|
42
43
|
|
43
44
|
post do |global_options,command,options,args|
|
@@ -45,9 +46,9 @@ class Cli
|
|
45
46
|
|
46
47
|
Machinery::Ui.puts "\nMachinery can show hints which guide through a typical workflow."
|
47
48
|
if @config.hints
|
48
|
-
Machinery::Ui.puts "These hints can be switched off by '#{$0} config hints
|
49
|
+
Machinery::Ui.puts "These hints can be switched off by '#{$0} config hints=off'."
|
49
50
|
else
|
50
|
-
Machinery::Ui.puts "These hints can be switched on by '#{$0} config hints
|
51
|
+
Machinery::Ui.puts "These hints can be switched on by '#{$0} config hints=on'."
|
51
52
|
end
|
52
53
|
|
53
54
|
Hint.print(:get_started)
|
@@ -57,11 +58,17 @@ class Cli
|
|
57
58
|
|
58
59
|
GLI::Commands::Help.skips_post = false
|
59
60
|
|
60
|
-
def self.
|
61
|
-
if
|
62
|
-
message = "
|
61
|
+
def self.validate_number_of_arguments(defined, parsed)
|
62
|
+
if defined.any?(&:multiple?) && parsed.empty?
|
63
|
+
message = "No arguments given. Nothing to do."
|
64
|
+
raise GLI::BadCommandLine.new(message)
|
65
|
+
elsif !defined.any?(&:multiple?) && parsed.size > defined.size
|
66
|
+
parsed_arguments = "#{parsed.size} #{Machinery.pluralize(parsed.size, "argument")}"
|
67
|
+
defined_arguments = defined.empty? ? "none" : "only: #{defined.map(&:name).join(", ")}"
|
68
|
+
message = "Too many arguments: got #{parsed_arguments}, expected #{defined_arguments}"
|
63
69
|
raise GLI::BadCommandLine.new(message)
|
64
70
|
end
|
71
|
+
|
65
72
|
true
|
66
73
|
end
|
67
74
|
|
@@ -200,9 +207,9 @@ class Cli
|
|
200
207
|
form = invalid_scopes.length > 1 ? "scopes are" : "scope is"
|
201
208
|
raise Machinery::Errors::UnknownScope.new(
|
202
209
|
"The following #{form} not valid:" \
|
203
|
-
"
|
210
|
+
" '#{invalid_scopes.join("', '")}'." \
|
204
211
|
" Scope names must start with a letter and contain only lowercase" \
|
205
|
-
" letters and digits separated by dashes (
|
212
|
+
" letters and digits separated by dashes ('-')."
|
206
213
|
)
|
207
214
|
end
|
208
215
|
|
@@ -567,7 +574,8 @@ class Cli
|
|
567
574
|
|
568
575
|
The success of a removal can be shown with the verbose option.
|
569
576
|
LONGDESC
|
570
|
-
arg "NAME
|
577
|
+
arg "NAME", :multiple
|
578
|
+
|
571
579
|
command :remove do |c|
|
572
580
|
c.switch :all, negatable: false,
|
573
581
|
desc: "Remove all system descriptions"
|
@@ -709,14 +717,22 @@ class Cli
|
|
709
717
|
arg "VALUE", :optional
|
710
718
|
command "config" do |c|
|
711
719
|
c.action do |global_options,options,args|
|
712
|
-
|
713
|
-
|
720
|
+
if args[0] && args[0].include?("=")
|
721
|
+
if args[1]
|
722
|
+
raise GLI::BadCommandLine, "Too many arguments: got 2 arguments, expected only: KEY=VALUE"
|
723
|
+
else
|
724
|
+
key, value = args[0].split("=")
|
725
|
+
end
|
726
|
+
else
|
727
|
+
key = args[0]
|
728
|
+
value = args[1]
|
729
|
+
end
|
714
730
|
|
715
731
|
task = ConfigTask.new
|
716
732
|
task.config(key, value)
|
717
733
|
|
718
734
|
if key == "hints" && !@config.hints
|
719
|
-
Machinery::Ui.puts "Hints can be switched on again by '#{$0} config hints
|
735
|
+
Machinery::Ui.puts "Hints can be switched on again by '#{$0} config hints=on'."
|
720
736
|
end
|
721
737
|
end
|
722
738
|
end
|
data/lib/config_base.rb
CHANGED
@@ -60,8 +60,9 @@ class ConfigBase
|
|
60
60
|
|
61
61
|
# Check if data type is correct. true and false are not of the same type which makes the check complex
|
62
62
|
if value.class != @entries[key][:value].class &&
|
63
|
-
!
|
64
|
-
raise Machinery::Errors::MachineryError
|
63
|
+
!(boolean?(value) && boolean?(@entries[key][:value]))
|
64
|
+
raise Machinery::Errors::MachineryError,
|
65
|
+
"The value '#{value}' for configuration key '#{key}' is of an invalid data type."
|
65
66
|
end
|
66
67
|
|
67
68
|
@entries[key][:value] = value
|
@@ -69,9 +70,12 @@ class ConfigBase
|
|
69
70
|
save if options[:auto_save]
|
70
71
|
end
|
71
72
|
|
72
|
-
|
73
73
|
private
|
74
74
|
|
75
|
+
def boolean?(value)
|
76
|
+
value.is_a?(TrueClass) || value.is_a?(FalseClass)
|
77
|
+
end
|
78
|
+
|
75
79
|
def save
|
76
80
|
config_table_stripped = {}
|
77
81
|
@entries.each do |key,value|
|
@@ -82,9 +86,9 @@ class ConfigBase
|
|
82
86
|
|
83
87
|
begin
|
84
88
|
File.write(@file, config_table_stripped.to_yaml)
|
85
|
-
Machinery.logger.info("Wrote configuration file
|
89
|
+
Machinery.logger.info("Wrote configuration file '#{@file}'.")
|
86
90
|
rescue => e
|
87
|
-
raise Machinery::Errors::MachineryError.new("Could not write configuration file
|
91
|
+
raise Machinery::Errors::MachineryError.new("Could not write configuration file '#{@file}': #{e}.")
|
88
92
|
end
|
89
93
|
end
|
90
94
|
|
@@ -95,7 +99,7 @@ class ConfigBase
|
|
95
99
|
begin
|
96
100
|
set(key, value, :auto_save => false )
|
97
101
|
rescue => e
|
98
|
-
Machinery::Ui.warn "Warning: The machinery config file
|
102
|
+
Machinery::Ui.warn "Warning: The machinery config file '#{file}' contains an invalid entry '#{key}':\n#{e}"
|
99
103
|
end
|
100
104
|
end
|
101
105
|
end
|
@@ -103,9 +107,9 @@ class ConfigBase
|
|
103
107
|
def read_config_file(file)
|
104
108
|
begin
|
105
109
|
content = YAML.load_file(file)
|
106
|
-
Machinery.logger.info("Read configuration file
|
110
|
+
Machinery.logger.info("Read configuration file '#{file}'.")
|
107
111
|
rescue => e
|
108
|
-
Machinery::Ui.warn "Warning: Cannot parse machinery config file
|
112
|
+
Machinery::Ui.warn "Warning: Cannot parse machinery config file '#{@file}':\n#{e}"
|
109
113
|
end
|
110
114
|
content
|
111
115
|
end
|
data/lib/local_system.rb
CHANGED
@@ -50,7 +50,9 @@ class LocalSystem < System
|
|
50
50
|
message = <<EOF
|
51
51
|
You are running Machinery on a platform we do not explicitly support and test.
|
52
52
|
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.
|
53
|
-
Oficially supported operating systems are: #{supported_oses}
|
53
|
+
Oficially supported operating systems are: '#{supported_oses}'
|
54
|
+
|
55
|
+
To disable this message in the machinery configuration use 'machinery config perform-support-check=false'
|
54
56
|
EOF
|
55
57
|
|
56
58
|
Machinery::Ui.warn message
|
data/lib/remove_task.rb
CHANGED
@@ -32,11 +32,11 @@ class RemoveTask
|
|
32
32
|
|
33
33
|
Array(names).each do |name|
|
34
34
|
if !store.list.include?(name)
|
35
|
-
errors.push("System description
|
35
|
+
errors.push("System description '#{name}' does not exist.")
|
36
36
|
else
|
37
37
|
store.remove(name)
|
38
38
|
if options[:verbose]
|
39
|
-
Machinery::Ui.puts "System description
|
39
|
+
Machinery::Ui.puts "System description '#{name}' successfully removed."
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
data/lib/show_task.rb
CHANGED
@@ -36,7 +36,7 @@ class ShowTask
|
|
36
36
|
LoggedCheetah.run("xdg-open", html_path)
|
37
37
|
rescue Cheetah::ExecutionFailed => e
|
38
38
|
raise Machinery::Errors::OpenInBrowserFailed.new(
|
39
|
-
"Could not open system description
|
39
|
+
"Could not open system description '#{description.name}' in the web browser.\n" \
|
40
40
|
"Error: #{e}\n"
|
41
41
|
)
|
42
42
|
end
|
data/lib/system_description.rb
CHANGED
@@ -75,14 +75,14 @@ class SystemDescription < Machinery::Object
|
|
75
75
|
def validate_name(name)
|
76
76
|
if ! /^[\w\.:-]*$/.match(name)
|
77
77
|
raise Machinery::Errors::SystemDescriptionError.new(
|
78
|
-
"System description name
|
79
|
-
"Only
|
78
|
+
"System description name '#{name}' is invalid. " +
|
79
|
+
"Only 'a-zA-Z0-9_:.-' are valid characters."
|
80
80
|
)
|
81
81
|
end
|
82
82
|
|
83
83
|
if name.start_with?(".")
|
84
84
|
raise Machinery::Errors::SystemDescriptionError.new(
|
85
|
-
"System description name
|
85
|
+
"System description name '#{name}' is invalid. " +
|
86
86
|
"A dot is not allowed as first character."
|
87
87
|
)
|
88
88
|
end
|
@@ -134,7 +134,7 @@ class SystemDescriptionStore
|
|
134
134
|
def validate_existence_of_description(description_name)
|
135
135
|
if !list.include?(description_name)
|
136
136
|
raise Machinery::Errors::SystemDescriptionNotFound.new(
|
137
|
-
"System description
|
137
|
+
"System description '#{description_name}' does not exist."
|
138
138
|
)
|
139
139
|
end
|
140
140
|
end
|
@@ -142,7 +142,7 @@ class SystemDescriptionStore
|
|
142
142
|
def validate_nonexistence_of_description(description_name)
|
143
143
|
if list.include?(description_name)
|
144
144
|
raise Machinery::Errors::SystemDescriptionError.new(
|
145
|
-
"A System description with the name
|
145
|
+
"A System description with the name '#{description_name}' does already exist."
|
146
146
|
)
|
147
147
|
end
|
148
148
|
end
|
data/lib/upgrade_format_task.rb
CHANGED
@@ -19,7 +19,7 @@ class UpgradeFormatTask
|
|
19
19
|
def upgrade(store, name, options = {})
|
20
20
|
if !options[:all] && !store.list.include?(name)
|
21
21
|
raise Machinery::Errors::SystemDescriptionNotFound.new(
|
22
|
-
"System description
|
22
|
+
"System description '#{name}' does not exist."
|
23
23
|
)
|
24
24
|
end
|
25
25
|
|
@@ -35,8 +35,8 @@ class UpgradeFormatTask
|
|
35
35
|
descriptions.each do |description|
|
36
36
|
begin
|
37
37
|
hash = Manifest.load(description, store.manifest_path(description)).to_hash
|
38
|
-
Machinery.logger.info "Upgrading description
|
39
|
-
Machinery::Ui.print "Reading
|
38
|
+
Machinery.logger.info "Upgrading description '#{description}'"
|
39
|
+
Machinery::Ui.print "Reading '#{description}' ... "
|
40
40
|
migrated = Migration.migrate_description(store, description, force: options[:force])
|
41
41
|
|
42
42
|
if migrated
|
@@ -45,7 +45,7 @@ class UpgradeFormatTask
|
|
45
45
|
" #{hash["meta"]["format_version"]} to #{SystemDescription::CURRENT_FORMAT_VERSION}."
|
46
46
|
end
|
47
47
|
rescue StandardError => e
|
48
|
-
errors.push("Upgrading description
|
48
|
+
errors.push("Upgrading description '#{description}' failed:\n#{e}")
|
49
49
|
Machinery::Ui.puts "Upgrade failed."
|
50
50
|
end
|
51
51
|
end
|
data/lib/version.rb
CHANGED
Binary file
|
@@ -533,8 +533,11 @@ list:</p>
|
|
533
533
|
|
534
534
|
<h3 id="SYNOPSIS">SYNOPSIS</h3>
|
535
535
|
|
536
|
-
<p><code>machinery config</code>
|
537
|
-
|
536
|
+
<p><code>machinery config</code></p>
|
537
|
+
|
538
|
+
<p><code>machinery config</code> KEY</p>
|
539
|
+
|
540
|
+
<p><code>machinery config</code> KEY=VALUE</p>
|
538
541
|
|
539
542
|
<p><code>machinery</code> help config</p>
|
540
543
|
|
@@ -561,7 +564,7 @@ If key and value are specified this configuration entry is set accordingly.</p>
|
|
561
564
|
<dl>
|
562
565
|
<dt>Turn off hints:</dt><dd><p></p>
|
563
566
|
|
564
|
-
<p>$ <code>machinery</code> config hints
|
567
|
+
<p>$ <code>machinery</code> config hints=off</p></dd>
|
565
568
|
<dt>Show current configuration of hints:</dt><dd><p></p>
|
566
569
|
|
567
570
|
<p>$ <code>machinery</code> config hints</p></dd>
|
@@ -844,7 +847,7 @@ See the <a href="#Scopes" data-bare-link="true">Scope section</a> for more infor
|
|
844
847
|
<dt><code>-r USER</code>, <code>--remote-user=USER</code> (optional)</dt><dd><p>Defines the user which is used to access the inspected system via SSH.
|
845
848
|
This user needs to be allowed to run certain commands using sudo (see
|
846
849
|
PREREQUISITES for more information).
|
847
|
-
To change the default-user use <code>machinery config remote-user
|
850
|
+
To change the default-user use <code>machinery config remote-user=USER</code></p></dd>
|
848
851
|
<dt><code>-x</code>, <code>--extract-files</code> (optional)</dt><dd><p>Extract changed configuration and unmanaged files from the inspected system.
|
849
852
|
Shortcut for the combination of <code>--extract-changed-config-files</code>,
|
850
853
|
<code>--extract-unmanaged-files</code>, and <code>--extract-changed-managed-files</code></p></dd>
|
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.9.
|
4
|
+
version: 1.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SUSE
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cheetah
|