bosh_cpi 1.2859.0 → 1.2862.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: 25514dc6b8fd25d7584f22e1b7817ae48b9da356
4
- data.tar.gz: df2cb03482aab909cdb7c0f0aa982cc8a4e01c42
3
+ metadata.gz: e4688fc1dc7da04093348f17a90759ac63fa9408
4
+ data.tar.gz: 047750a4f42639e735b06e888673a4d385229966
5
5
  SHA512:
6
- metadata.gz: e7205fdc29c6ff4ec4957d09ce81227610aed88527069d4f67939e09d12afbeaf31008b389e0ac3690ec881d39a480712c3c2132fbdf06dc93e20ef6d5600f5d
7
- data.tar.gz: fac8b72f62dcf088d33081fd4864bccb778ace43ea341a18be1a8058ee96c55e31c805b251f8d618d8a370d76721aafbca16e041dc1f4f6feec9e5087db15d21
6
+ metadata.gz: 22b2b9c964783df0ad18968236d6178857edde58f64666f194681a7fd42a0eb66d3289b6e9b3f0b2c459e89c5852107b34999fe29f999875ca8d936ec564dc3a
7
+ data.tar.gz: 5410092f3a0fcfa3952578b9a6837b1a23bb5c78de0f5e8a250b51a8d9736526b48327ee687a43f72bd9e2bc0c0ab60488effd77d32988dbfbe171aa4fbb5cc2
@@ -26,27 +26,6 @@ module Bosh::Clouds
26
26
  Bosh::Clouds::VMCreationFailed
27
27
  ).freeze
28
28
 
29
- KNOWN_RPC_METHODS = %w(
30
- current_vm_id
31
- create_stemcell
32
- delete_stemcell
33
- create_vm
34
- delete_vm
35
- has_vm?
36
- reboot_vm
37
- set_vm_metadata
38
- configure_networks
39
- create_disk
40
- has_disk?
41
- delete_disk
42
- attach_disk
43
- detach_disk
44
- snapshot_disk
45
- delete_snapshot
46
- get_disks
47
- ping
48
- ).freeze
49
-
50
29
  RESPONSE_SCHEMA = Membrane::SchemaParser.parse do
51
30
  {
52
31
  'result' => any,
@@ -66,9 +45,29 @@ module Bosh::Clouds
66
45
  @logger = Config.logger
67
46
  end
68
47
 
69
- KNOWN_RPC_METHODS.each do |method_name|
70
- define_method method_name do |*arguments|
71
- request = JSON.dump({
48
+ def current_vm_id(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
49
+ def create_stemcell(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
50
+ def delete_stemcell(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
51
+ def create_vm(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
52
+ def delete_vm(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
53
+ def has_vm?(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
54
+ def reboot_vm(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
55
+ def set_vm_metadata(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
56
+ def configure_networks(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
57
+ def create_disk(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
58
+ def has_disk?(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
59
+ def delete_disk(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
60
+ def attach_disk(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
61
+ def detach_disk(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
62
+ def snapshot_disk(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
63
+ def delete_snapshot(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
64
+ def get_disks(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
65
+ def ping(*arguments); invoke_cpi_method(__method__.to_s, *arguments); end
66
+
67
+ private
68
+
69
+ def invoke_cpi_method(method_name, *arguments)
70
+ request = JSON.dump({
72
71
  'method' => method_name.gsub(/\?$/,''),
73
72
  'arguments' => arguments,
74
73
  'context' => {
@@ -76,28 +75,25 @@ module Bosh::Clouds
76
75
  }
77
76
  })
78
77
 
79
- env = {'PATH' => '/usr/sbin:/usr/bin:/sbin:/bin', 'TMPDIR' => ENV['TMPDIR']}
80
- cpi_exec_path = checked_cpi_exec_path
78
+ env = {'PATH' => '/usr/sbin:/usr/bin:/sbin:/bin', 'TMPDIR' => ENV['TMPDIR']}
79
+ cpi_exec_path = checked_cpi_exec_path
81
80
 
82
- @logger.debug("External CPI sending request: #{request} with command: #{cpi_exec_path}")
83
- cpi_response, stderr, exit_status = Open3.capture3(env, cpi_exec_path, stdin_data: request)
84
- @logger.debug("External CPI got response: #{cpi_response}, err: #{stderr}, exit_status: #{exit_status}")
81
+ @logger.debug("External CPI sending request: #{request} with command: #{cpi_exec_path}")
82
+ cpi_response, stderr, exit_status = Open3.capture3(env, cpi_exec_path, stdin_data: request, unsetenv_others: true)
83
+ @logger.debug("External CPI got response: #{cpi_response}, err: #{stderr}, exit_status: #{exit_status}")
85
84
 
86
- parsed_response = parsed_response(cpi_response)
87
- validate_response(parsed_response)
85
+ parsed_response = parsed_response(cpi_response)
86
+ validate_response(parsed_response)
88
87
 
89
- if parsed_response['error']
90
- handle_error(parsed_response['error'])
91
- end
88
+ if parsed_response['error']
89
+ handle_error(parsed_response['error'])
90
+ end
92
91
 
93
- save_cpi_log(parsed_response['log'])
92
+ save_cpi_log(parsed_response['log'])
94
93
 
95
- parsed_response['result']
96
- end
94
+ parsed_response['result']
97
95
  end
98
96
 
99
- private
100
-
101
97
  def checked_cpi_exec_path
102
98
  unless File.executable?(@cpi_path)
103
99
  raise NonExecutable, "Failed to run cpi: `#{@cpi_path}' is not executable"
@@ -1,8 +1,8 @@
1
1
  module Bosh::Clouds
2
2
  class Provider
3
3
  def self.create(cloud_config, director_uuid)
4
- if cloud_config.has_key?('cpi_executable')
5
- ExternalCpiProvider.create(cloud_config['cpi_executable'], director_uuid)
4
+ if cloud_config.has_key?('provider')
5
+ ExternalCpiProvider.create(cloud_config['provider']['path'], director_uuid)
6
6
  else
7
7
  PluginCloudProvider.create(cloud_config['plugin'], cloud_config['properties'])
8
8
  end
@@ -24,8 +24,8 @@ module Bosh::Clouds
24
24
  end
25
25
 
26
26
  class ExternalCpiProvider
27
- def self.create(cpi_executable, director_uuid)
28
- ExternalCpi.new(cpi_executable, director_uuid)
27
+ def self.create(cpi_job_path, director_uuid)
28
+ ExternalCpi.new(cpi_job_path, director_uuid)
29
29
  end
30
30
  end
31
31
  end
data/lib/cloud/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Clouds
3
- VERSION = '1.2859.0'
3
+ VERSION = '1.2862.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2859.0
4
+ version: 1.2862.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bosh_common
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2859.0
19
+ version: 1.2862.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.2859.0
26
+ version: 1.2862.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: membrane
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: 1.8.2
55
55
  description: |-
56
56
  BOSH CPI
57
- 8b7528
57
+ c8ad5c
58
58
  email: support@cloudfoundry.com
59
59
  executables: []
60
60
  extensions: []