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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fa664c89d067292bb4703e9b8bba47651981831
4
- data.tar.gz: 45c13a6f27432d9fc09ab306cdad7c07680df73f
3
+ metadata.gz: e8755dd722d4450f406fe08db1700528783ff297
4
+ data.tar.gz: 3709616bfe0e90ac03543cda9ad942cc60ee8800
5
5
  SHA512:
6
- metadata.gz: f31cd802cb1ce442b18bb0dd374f9308371bf7376e168d97608d5a0ff94e10164d11c6cc0ed58c40aaad230338430c966f5013f3a8c49c940ab1ed45f810ca32
7
- data.tar.gz: b1d69fc9f41836dab29ff51e449861517527b9b205ad5e6ccc6ef981199b40386518a93c02a98d3454b25bf842914c8da9f106a15179aa71e11c2e8b8b924908
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
- check_exceeding_arguments(command.arguments, args)
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 off'."
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 on'."
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.check_exceeding_arguments(defined, parsed)
61
- if parsed.size > defined.size
62
- message = "The given arguments don't match the command's specified arguments."
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
- " \"#{invalid_scopes.join("\", \"")}\"." \
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
- key = args[0]
713
- value = args[1]
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 on'."
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
- ! ( ( value == true || value == false ) && ( @entries[key][:value].class == TrueClass || @entries[key][:value].class == FalseClass ) )
64
- raise Machinery::Errors::MachineryError.new("The value \"#{value}\" for configuration key \"#{key}\" is of an invalid data type.")
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 \"#{@file}\".")
89
+ Machinery.logger.info("Wrote configuration file '#{@file}'.")
86
90
  rescue => e
87
- raise Machinery::Errors::MachineryError.new("Could not write configuration file \"#{@file}\": #{e}.")
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 \"#{file}\" contains an invalid entry \"#{key}\":\n#{e}"
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 \"#{file}\".")
110
+ Machinery.logger.info("Read configuration file '#{file}'.")
107
111
  rescue => e
108
- Machinery::Ui.warn "Warning: Cannot parse machinery config file \"#{@file}\":\n#{e}"
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 \"#{name}\" does not exist.")
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 \"#{name}\" successfully removed."
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 \"#{description.name}\" in the web browser.\n" \
39
+ "Could not open system description '#{description.name}' in the web browser.\n" \
40
40
  "Error: #{e}\n"
41
41
  )
42
42
  end
@@ -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 \"#{name}\" is invalid. " +
79
- "Only \"a-zA-Z0-9_:.-\" are valid characters."
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 \"#{name}\" is invalid. " +
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 \"#{description_name}\" does not exist."
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 \"#{description_name}\" does already exist."
145
+ "A System description with the name '#{description_name}' does already exist."
146
146
  )
147
147
  end
148
148
  end
@@ -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 \"#{name}\" does not exist."
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 \"#{description}\""
39
- Machinery::Ui.print "Reading \"#{description}\" ... "
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 \"#{description}\" failed:\n#{e}")
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
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Machinery
19
19
 
20
- VERSION = "1.9.0"
20
+ VERSION = "1.9.1"
21
21
 
22
22
  end
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
- [KEY] [VALUE]</p>
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 off</p></dd>
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 USER</code></p></dd>
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.0
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-17 00:00:00.000000000 Z
11
+ date: 2015-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cheetah