crowbar-client 2.1.0 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -0
  3. data/lib/crowbar/client.rb +6 -0
  4. data/lib/crowbar/client/app.rb +3 -0
  5. data/lib/crowbar/client/app/barclamp.rb +2 -2
  6. data/lib/crowbar/client/app/base.rb +24 -1
  7. data/lib/crowbar/client/app/batch.rb +4 -4
  8. data/lib/crowbar/client/app/entry.rb +4 -0
  9. data/lib/crowbar/client/app/host_ip.rb +4 -4
  10. data/lib/crowbar/client/app/installer.rb +103 -0
  11. data/lib/crowbar/client/app/interface.rb +4 -4
  12. data/lib/crowbar/client/app/node.rb +34 -34
  13. data/lib/crowbar/client/app/proposal.rb +14 -14
  14. data/lib/crowbar/client/app/repository.rb +10 -10
  15. data/lib/crowbar/client/app/reset.rb +4 -4
  16. data/lib/crowbar/client/app/role.rb +4 -4
  17. data/lib/crowbar/client/app/server.rb +2 -2
  18. data/lib/crowbar/client/app/virtual_ip.rb +4 -4
  19. data/lib/crowbar/client/command.rb +3 -0
  20. data/lib/crowbar/client/command/installer.rb +29 -0
  21. data/lib/crowbar/client/command/installer/start.rb +50 -0
  22. data/lib/crowbar/client/command/installer/status.rb +68 -0
  23. data/lib/crowbar/client/command/proposal/create.rb +19 -5
  24. data/lib/crowbar/client/command/proposal/edit.rb +19 -5
  25. data/lib/crowbar/client/request.rb +3 -0
  26. data/lib/crowbar/client/request/base.rb +12 -0
  27. data/lib/crowbar/client/request/installer.rb +29 -0
  28. data/lib/crowbar/client/request/installer/start.rb +44 -0
  29. data/lib/crowbar/client/request/installer/status.rb +36 -0
  30. data/lib/crowbar/client/version.rb +1 -1
  31. data/spec/crowbar/client/command/installer/start_spec.rb +40 -0
  32. data/spec/crowbar/client/command/installer/status_spec.rb +39 -0
  33. data/spec/crowbar/client/request/installer/start_spec.rb +55 -0
  34. data/spec/crowbar/client/request/installer/status_spec.rb +65 -0
  35. data/spec/support/request_examples.rb +4 -0
  36. metadata +84 -69
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5af7f5c6bab5cfaf58a39cd195ad78c94641d39b
4
- data.tar.gz: 038f95011bd1e449e7c5b3121df21447fc427ece
3
+ metadata.gz: 3ecbbfcbd11f4a3f271ac148b1b133a263d3bf8f
4
+ data.tar.gz: 8337b224ca654899291ab830294c173dbfe57403
5
5
  SHA512:
6
- metadata.gz: e3a803ba5baefeb1c258322cdbaf163bef2c90f40b0eb8344c7d889af337df7abd44860f6c453983fcff71d893ac8940921a9a9774be02668cd2ae3ae4cc917a
7
- data.tar.gz: f1ea6e61388e472b8a9be57f304c64b4da1620668f98eb16a2c56ae2a7cca81717e7da25814370dd8aec364e5945488c0649df791f75449e5185c7fa0ec0341c
6
+ metadata.gz: 3b7d1e3f3d934c75f3edde8df6db94b9f7843a38d9ac70e27ffa9481e341f89eda52aaa31414b5493d21fa366a835bba4d03228351faa19bed14d97621f56ac2
7
+ data.tar.gz: c27a8bded618b8ec1bc361519a079e4549d1090d8614ec195b1acbf3d6d9dfa712e91c45983e577116779a75fe93afb54dc031caf5d1c20ef3793f9149d65970
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.2.0](https://github.com/crowbar/crowbar-client/releases/tag/v2.2.0) - 2015-12-03
4
+
5
+ * BUGFIX
6
+ * Fixed reading of files for proposal create/edit (@tboerger)
7
+ * ENHANCEMENT
8
+ * Added proper error handling to file read on proposal (@tboerger)
9
+ * Added subcommands for installation of admin server (@MaximilianMeister)
10
+ * Added proper error handling for general connection (@tboerger)
11
+
3
12
  ## [2.1.0](https://github.com/crowbar/crowbar-client/releases/tag/v2.1.0) - 2015-11-25
4
13
 
5
14
  * BREAKING
@@ -49,6 +49,12 @@ module Crowbar
49
49
  class InvalidJsonError < SimpleCatchableError
50
50
  end
51
51
 
52
+ class InternalServerError < SimpleCatchableError
53
+ end
54
+
55
+ class NotAuthorizedError < SimpleCatchableError
56
+ end
57
+
52
58
  class UnavailableBarclampError < SimpleCatchableError
53
59
  def initialize(barclamp)
54
60
  super("Barclamp #{barclamp} is not available")
@@ -32,6 +32,9 @@ module Crowbar
32
32
  autoload :HostIP,
33
33
  File.expand_path("../app/host_ip", __FILE__)
34
34
 
35
+ autoload :Installer,
36
+ File.expand_path("../app/installer", __FILE__)
37
+
35
38
  autoload :Interface,
36
39
  File.expand_path("../app/interface", __FILE__)
37
40
 
@@ -69,8 +69,8 @@ module Crowbar
69
69
  Command::Barclamp::List.new(
70
70
  *command_params
71
71
  ).execute
72
- rescue SimpleCatchableError => e
73
- err e.message, 1
72
+ rescue => e
73
+ catch_errors(e)
74
74
  end
75
75
  end
76
76
  end
@@ -38,12 +38,22 @@ module Crowbar
38
38
  end
39
39
 
40
40
  no_commands do
41
+ include Mixin::Format
42
+
41
43
  def say(message)
42
44
  $stdout.puts message
43
45
  end
44
46
 
45
47
  def err(message, exit_code = nil)
46
- $stderr.puts message
48
+ case provide_format
49
+ when :json
50
+ $stderr.puts JSON.pretty_generate(
51
+ error: message
52
+ )
53
+ else
54
+ $stderr.puts message
55
+ end
56
+
47
57
  exit(exit_code) unless exit_code.nil?
48
58
  end
49
59
 
@@ -56,6 +66,19 @@ module Crowbar
56
66
  args
57
67
  ]
58
68
  end
69
+
70
+ def catch_errors(error)
71
+ case error
72
+ when SimpleCatchableError
73
+ err error.message, 1
74
+ when Errno::ECONNREFUSED
75
+ err "Connection to server refused", 1
76
+ when SocketError
77
+ err "Unknown server to connect to", 1
78
+ else
79
+ raise error
80
+ end
81
+ end
59
82
  end
60
83
  end
61
84
  end
@@ -54,8 +54,8 @@ module Crowbar
54
54
  file: file
55
55
  )
56
56
  ).execute
57
- rescue SimpleCatchableError => e
58
- err e.message, 1
57
+ rescue => e
58
+ catch_errors(e)
59
59
  end
60
60
 
61
61
  desc "export PROPOSAL [PROPOSAL]",
@@ -91,8 +91,8 @@ module Crowbar
91
91
  proposals: proposals
92
92
  )
93
93
  ).execute
94
- rescue SimpleCatchableError => e
95
- err e.message, 1
94
+ rescue => e
95
+ catch_errors(e)
96
96
  end
97
97
  end
98
98
  end
@@ -113,6 +113,10 @@ module Crowbar
113
113
  desc "server [COMMANDS]",
114
114
  "Server specific commands, call without params for help"
115
115
  subcommand "server", Crowbar::Client::App::Server
116
+
117
+ desc "installer [COMMANDS]",
118
+ "Installer specific commands, call without params for help"
119
+ subcommand "installer", Crowbar::Client::App::Installer
116
120
  end
117
121
  end
118
122
  end
@@ -36,8 +36,8 @@ module Crowbar
36
36
  suggestion: suggestion
37
37
  )
38
38
  ).execute
39
- rescue SimpleCatchableError => e
40
- err e.message, 1
39
+ rescue => e
40
+ catch_errors(e)
41
41
  end
42
42
 
43
43
  desc "deallocate PROPOSAL NODE NETWORK",
@@ -56,8 +56,8 @@ module Crowbar
56
56
  network: network
57
57
  )
58
58
  ).execute
59
- rescue SimpleCatchableError => e
60
- err e.message, 1
59
+ rescue => e
60
+ catch_errors(e)
61
61
  end
62
62
  end
63
63
  end
@@ -0,0 +1,103 @@
1
+ #
2
+ # Copyright 2015, SUSE Linux GmbH
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ module Crowbar
18
+ module Client
19
+ module App
20
+ class Installer < Base
21
+ desc "status",
22
+ "Show current installer status"
23
+
24
+ long_desc <<-LONGDESC
25
+ `status` will print out information about the current status
26
+ of the installer. You can display the list in different output
27
+ formats and you can filter the list by any search criteria.
28
+
29
+ With --format <format> option you can choose an output format
30
+ with the available options table, json or plain. You can also
31
+ use the shortcut options --table, --json or --plain.
32
+
33
+ With --filter <filter> option you can limit the result of
34
+ printed out elements. You can use any substring that is part
35
+ of the found elements.
36
+ LONGDESC
37
+
38
+ method_option :format,
39
+ type: :string,
40
+ default: "table",
41
+ banner: "<format>",
42
+ desc: "Format of the output, valid formats are table, json or plain"
43
+
44
+ method_option :table,
45
+ type: :boolean,
46
+ default: false,
47
+ aliases: [],
48
+ desc: "Format output as table, a shortcut for --format table option"
49
+
50
+ method_option :json,
51
+ type: :boolean,
52
+ default: false,
53
+ aliases: [],
54
+ desc: "Format output as table, a shortcut for --format table option"
55
+
56
+ method_option :plain,
57
+ type: :boolean,
58
+ default: false,
59
+ aliases: [],
60
+ desc: "Format output as table, a shortcut for --format table option"
61
+
62
+ method_option :filter,
63
+ type: :string,
64
+ default: nil,
65
+ banner: "<filter>",
66
+ desc: "Filter by criteria, display only data that contains filter"
67
+
68
+ def status
69
+ Command::Installer::Status.new(
70
+ *command_params
71
+ ).execute
72
+ rescue => e
73
+ catch_errors(e)
74
+ end
75
+
76
+ desc "start",
77
+ "Start the insallation of Crowbar"
78
+
79
+ long_desc <<-LONGDESC
80
+ `start` will trigger the installation of the Administration Server.
81
+
82
+ With --force you can enforce a reinstallation if the installation
83
+ has already been finished. Be careful with that option as you will
84
+ destroy an already existing installation.
85
+ LONGDESC
86
+
87
+ method_option :force,
88
+ type: :boolean,
89
+ default: false,
90
+ aliases: [],
91
+ desc: "Force Administration Server installation"
92
+
93
+ def start
94
+ Command::Installer::Start.new(
95
+ *command_params
96
+ ).execute
97
+ rescue => e
98
+ catch_errors(e)
99
+ end
100
+ end
101
+ end
102
+ end
103
+ end
@@ -34,8 +34,8 @@ module Crowbar
34
34
  network: network
35
35
  )
36
36
  ).execute
37
- rescue SimpleCatchableError => e
38
- err e.message, 1
37
+ rescue => e
38
+ catch_errors(e)
39
39
  end
40
40
 
41
41
  desc "disable PROPOSAL NODE NETWORK",
@@ -54,8 +54,8 @@ module Crowbar
54
54
  network: network
55
55
  )
56
56
  ).execute
57
- rescue SimpleCatchableError => e
58
- err e.message, 1
57
+ rescue => e
58
+ catch_errors(e)
59
59
  end
60
60
  end
61
61
  end
@@ -80,8 +80,8 @@ module Crowbar
80
80
  Command::Node::Status.new(
81
81
  *command_params
82
82
  ).execute
83
- rescue SimpleCatchableError => e
84
- err e.message, 1
83
+ rescue => e
84
+ catch_errors(e)
85
85
  end
86
86
 
87
87
  desc "list",
@@ -154,8 +154,8 @@ module Crowbar
154
154
  Command::Node::List.new(
155
155
  *command_params
156
156
  ).execute
157
- rescue SimpleCatchableError => e
158
- err e.message, 1
157
+ rescue => e
158
+ catch_errors(e)
159
159
  end
160
160
 
161
161
  desc "show NAME_OR_ALIAS",
@@ -215,8 +215,8 @@ module Crowbar
215
215
  name: name
216
216
  )
217
217
  ).execute
218
- rescue SimpleCatchableError => e
219
- err e.message, 1
218
+ rescue => e
219
+ catch_errors(e)
220
220
  end
221
221
 
222
222
  desc "hardware NAME_OR_ALIAS",
@@ -233,8 +233,8 @@ module Crowbar
233
233
  name: name
234
234
  )
235
235
  ).execute
236
- rescue SimpleCatchableError => e
237
- err e.message, 1
236
+ rescue => e
237
+ catch_errors(e)
238
238
  end
239
239
 
240
240
  desc "identify NAME_OR_ALIAS",
@@ -251,8 +251,8 @@ module Crowbar
251
251
  name: name
252
252
  )
253
253
  ).execute
254
- rescue SimpleCatchableError => e
255
- err e.message, 1
254
+ rescue => e
255
+ catch_errors(e)
256
256
  end
257
257
 
258
258
  desc "delete NAME_OR_ALIAS",
@@ -269,8 +269,8 @@ module Crowbar
269
269
  name: name
270
270
  )
271
271
  ).execute
272
- rescue SimpleCatchableError => e
273
- err e.message, 1
272
+ rescue => e
273
+ catch_errors(e)
274
274
  end
275
275
 
276
276
  desc "reinstall NAME_OR_ALIAS",
@@ -287,8 +287,8 @@ module Crowbar
287
287
  name: name
288
288
  )
289
289
  ).execute
290
- rescue SimpleCatchableError => e
291
- err e.message, 1
290
+ rescue => e
291
+ catch_errors(e)
292
292
  end
293
293
 
294
294
  desc "reset NAME_OR_ALIAS",
@@ -305,8 +305,8 @@ module Crowbar
305
305
  name: name
306
306
  )
307
307
  ).execute
308
- rescue SimpleCatchableError => e
309
- err e.message, 1
308
+ rescue => e
309
+ catch_errors(e)
310
310
  end
311
311
 
312
312
  desc "shutdown NAME_OR_ALIAS",
@@ -323,8 +323,8 @@ module Crowbar
323
323
  name: name
324
324
  )
325
325
  ).execute
326
- rescue SimpleCatchableError => e
327
- err e.message, 1
326
+ rescue => e
327
+ catch_errors(e)
328
328
  end
329
329
 
330
330
  desc "reboot NAME_OR_ALIAS",
@@ -341,8 +341,8 @@ module Crowbar
341
341
  name: name
342
342
  )
343
343
  ).execute
344
- rescue SimpleCatchableError => e
345
- err e.message, 1
344
+ rescue => e
345
+ catch_errors(e)
346
346
  end
347
347
 
348
348
  desc "powercycle NAME_OR_ALIAS",
@@ -359,8 +359,8 @@ module Crowbar
359
359
  name: name
360
360
  )
361
361
  ).execute
362
- rescue SimpleCatchableError => e
363
- err e.message, 1
362
+ rescue => e
363
+ catch_errors(e)
364
364
  end
365
365
 
366
366
  desc "poweroff NAME_OR_ALIAS",
@@ -377,8 +377,8 @@ module Crowbar
377
377
  name: name
378
378
  )
379
379
  ).execute
380
- rescue SimpleCatchableError => e
381
- err e.message, 1
380
+ rescue => e
381
+ catch_errors(e)
382
382
  end
383
383
 
384
384
  desc "poweron NAME_OR_ALIAS",
@@ -395,8 +395,8 @@ module Crowbar
395
395
  name: name
396
396
  )
397
397
  ).execute
398
- rescue SimpleCatchableError => e
399
- err e.message, 1
398
+ rescue => e
399
+ catch_errors(e)
400
400
  end
401
401
 
402
402
  desc "allocate NAME_OR_ALIAS",
@@ -413,8 +413,8 @@ module Crowbar
413
413
  name: name
414
414
  )
415
415
  ).execute
416
- rescue SimpleCatchableError => e
417
- err e.message, 1
416
+ rescue => e
417
+ catch_errors(e)
418
418
  end
419
419
 
420
420
  desc "role NAME_OR_ALIAS ROLE",
@@ -432,8 +432,8 @@ module Crowbar
432
432
  value: value
433
433
  )
434
434
  ).execute
435
- rescue SimpleCatchableError => e
436
- err e.message, 1
435
+ rescue => e
436
+ catch_errors(e)
437
437
  end
438
438
 
439
439
  desc "rename NAME_OR_ALIAS ALIAS",
@@ -451,8 +451,8 @@ module Crowbar
451
451
  value: value
452
452
  )
453
453
  ).execute
454
- rescue SimpleCatchableError => e
455
- err e.message, 1
454
+ rescue => e
455
+ catch_errors(e)
456
456
  end
457
457
 
458
458
  desc "transition NAME_OR_ALIAS STATE",
@@ -470,8 +470,8 @@ module Crowbar
470
470
  state: state
471
471
  )
472
472
  ).execute
473
- rescue SimpleCatchableError => e
474
- err e.message, 1
473
+ rescue => e
474
+ catch_errors(e)
475
475
  end
476
476
  end
477
477
  end