bosh_cli 1.2732.0 → 1.2739.0

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: 369b59362e32cfaa7b06ce996e80a658b58426d0
4
- data.tar.gz: 14298cab8827d311d3a70e6f382816cb6c7566e5
3
+ metadata.gz: 657ec2e7e308f2278574ceab525e704466c37a01
4
+ data.tar.gz: bb8691cb23bd51c7b6428073c4d942811ff53262
5
5
  SHA512:
6
- metadata.gz: 6673ea9f3977df6a6ecee1c0ff9e3a842a5b3045704868035f2e2c39480d6340a5da12a0aaeb2e3b1e179ac13c07a2962e1b8bf94f62d9b8ff30e6baa966e6f1
7
- data.tar.gz: cd653bb276dc1fa26341ca258185124265ec185421f1424059dd5df6348a44702e0c61717b6d8244cff7cfe0dc5592b1f9d20ef1c356afb72927d40987e83588
6
+ metadata.gz: af5a16d77c2c37c78ed7588145549e7b9a02ab83aeee6405bfc15d669609c117a2222169bbef84fd874543f0477eeb337c0ecce9d64cccff88b43f199e4d031b
7
+ data.tar.gz: ec8cabb614df4814320a353466663bd9e4768c89160a8dc4304b1deae6a3e246dacb3565d2c47df55549a39e6ddcf0f7f765b2af31f793f1c43f0184b5c4645d
@@ -121,6 +121,10 @@ module Bosh
121
121
  get_json('/deployments')
122
122
  end
123
123
 
124
+ def list_errands(deployment_name)
125
+ get_json("/deployments/#{deployment_name}/errands")
126
+ end
127
+
124
128
  def list_running_tasks(verbose = 1)
125
129
  get_json("/tasks?state=processing,cancelling,queued&verbose=#{verbose}")
126
130
  end
@@ -2,14 +2,41 @@ require 'cli/client/errands_client'
2
2
 
3
3
  module Bosh::Cli::Command
4
4
  class Errand < Base
5
+ usage 'errands'
6
+ desc 'List available errands'
7
+ def errands
8
+ deployment_required
9
+ errands = list_errands
10
+
11
+ if errands.size > 0
12
+ errands_table = table do |t|
13
+ t.headings = ['Name']
14
+ errands.each { |errand| t << [errand['name']] }
15
+ end
16
+ nl
17
+ say(errands_table)
18
+ else
19
+ err("Deployment has no available errands")
20
+ end
21
+ end
22
+
5
23
  usage 'run errand'
6
24
  desc 'Run specified errand'
7
25
  option '--download-logs', 'download logs'
8
26
  option '--logs-dir destination_directory', String, 'logs download directory'
9
- def run_errand(errand_name)
27
+ def run_errand(errand_name=nil)
10
28
  auth_required
11
29
  deployment_required
12
30
 
31
+ unless errand_name
32
+ errand = prompt_for_errand_name
33
+ errand_name = errand['name']
34
+ end
35
+ perform_run_errand(errand_name)
36
+ end
37
+
38
+ private
39
+ def perform_run_errand(errand_name)
13
40
  deployment_name = prepare_deployment_manifest['name']
14
41
 
15
42
  errands_client = Bosh::Cli::Client::ErrandsClient.new(director)
@@ -264,6 +264,21 @@ module Bosh::Cli
264
264
  end
265
265
  end
266
266
 
267
+ # return a job/errand selected by user by name
268
+ def prompt_for_errand_name
269
+ errands = list_errands
270
+
271
+ err("Deployment has no available errands") if errands.size == 0
272
+ return errands.first if errands.size == 1
273
+
274
+ choose do |menu|
275
+ menu.prompt = 'Choose an errand: '
276
+ errands.each do |errand, index|
277
+ menu.choice("#{errand['name']}") { errand }
278
+ end
279
+ end
280
+ end
281
+
267
282
  def jobs_and_indexes
268
283
  jobs = prepare_deployment_manifest.fetch('jobs')
269
284
 
@@ -287,6 +302,11 @@ module Bosh::Cli
287
302
  jobs.find { |job| job.fetch('name') == job_name }
288
303
  end
289
304
 
305
+ def list_errands
306
+ deployment_name = prepare_deployment_manifest.fetch('name')
307
+ director.list_errands(deployment_name)
308
+ end
309
+
290
310
  def find_deployment(name)
291
311
  if File.exists?(name)
292
312
  File.expand_path(name)
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Cli
3
- VERSION = '1.2732.0'
3
+ VERSION = '1.2739.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2732.0
4
+ version: 1.2739.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-30 00:00:00.000000000 Z
11
+ date: 2014-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bosh_common
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2732.0
19
+ version: 1.2739.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2732.0
26
+ version: 1.2739.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bosh-template
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.2732.0
33
+ version: 1.2739.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.2732.0
40
+ version: 1.2739.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json_pure
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 1.2732.0
117
+ version: 1.2739.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 1.2732.0
124
+ version: 1.2739.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: net-ssh
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -194,7 +194,7 @@ dependencies:
194
194
  version: 0.5.4
195
195
  description: |-
196
196
  BOSH CLI
197
- f6dedd
197
+ 0d77bd
198
198
  email: support@cloudfoundry.com
199
199
  executables:
200
200
  - bosh