bosh_cpi 1.3215.3.1 → 1.3215.4.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: e47a8b1c490ee6b087454854ea70db9db74a0501
4
- data.tar.gz: 365900e4eda1c666317d58416b632228c0f84784
3
+ metadata.gz: f5b072ecb87cfd52cf3c3f05e4b398191297dd56
4
+ data.tar.gz: 9555b9b810020665f128621b7b6b1dc1093d58f8
5
5
  SHA512:
6
- metadata.gz: f4c6e3b7ef8f6f7276f8e627051dcbee701aa482051cc6dd5594b212d7297c08ff8171786d7c5488c081daa7ff80b113c81e657efb021148efeb92987d0f623d
7
- data.tar.gz: 39e8e7e42f4d0b3ea8e8d7812e8fee9aae41acbb6deca601a62d473cffa3dafb54f39f2271b518b40efa4f67b369abf042580696d5f5f5d5bea2b1036dad5f91
6
+ metadata.gz: 5360ba99e403b6af0f62001d38a5926432a83bea1d6122847450d9f8d81cf50e6034b1fa020500058dcd5893dd84caac0fe95f6188851a33176ccc57ab34c61c
7
+ data.tar.gz: cef7d85065d4269dd3d5e3f80b581a462d3d58e544383ab0e8bd37f2a3ede33efed21afaf85123bce427b90ac01bca73717b9e004ffce5fdd61626d2fac47d85
@@ -7,7 +7,7 @@ module Bosh::Cpi::CompatibilityHelpers
7
7
  it "raises VMNotFound error" do
8
8
  expect {
9
9
  cpi.delete_vm(vm_cid)
10
- }.to raise_error(Bosh::Clouds::VMNotFound, "VM '#{vm_cid}' not found")
10
+ }.to raise_error(Bosh::Clouds::VMNotFound, "VM `#{vm_cid}' not found")
11
11
  end
12
12
  end
13
13
  end
data/lib/bosh/cpi.rb CHANGED
@@ -3,4 +3,3 @@ module Bosh
3
3
  end
4
4
 
5
5
  require 'bosh/cpi/cli'
6
- require 'bosh/cpi/registry_client'
@@ -96,7 +96,7 @@ module Bosh::Clouds
96
96
 
97
97
  def checked_cpi_exec_path
98
98
  unless File.executable?(@cpi_path)
99
- raise NonExecutable, "Failed to run cpi: '#{@cpi_path}' is not executable"
99
+ raise NonExecutable, "Failed to run cpi: `#{@cpi_path}' is not executable"
100
100
  end
101
101
  @cpi_path
102
102
  end
data/lib/cloud/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Clouds
3
- VERSION = '1.3215.0'
3
+ VERSION = '1.3215.4.0'
4
4
  end
5
5
  end
data/lib/cloud.rb CHANGED
@@ -214,7 +214,7 @@ module Bosh
214
214
 
215
215
  def not_implemented(method)
216
216
  raise Bosh::Clouds::NotImplemented,
217
- "'#{method}' is not implemented by #{self.class}"
217
+ "`#{method}' is not implemented by #{self.class}"
218
218
  end
219
219
 
220
220
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bosh_cpi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3215.3.1
4
+ version: 1.3215.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2016-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bosh_common
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3215.4.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3215.4.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: membrane
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -90,7 +104,6 @@ files:
90
104
  - lib/bosh/cpi/cli.rb
91
105
  - lib/bosh/cpi/compatibility_helpers.rb
92
106
  - lib/bosh/cpi/compatibility_helpers/delete_vm.rb
93
- - lib/bosh/cpi/registry_client.rb
94
107
  - lib/bosh/cpi/tasks.rb
95
108
  - lib/bosh/cpi/tasks/spec.rake
96
109
  - lib/cloud.rb
@@ -120,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
133
  version: '0'
121
134
  requirements: []
122
135
  rubyforge_project:
123
- rubygems_version: 2.2.5
136
+ rubygems_version: 2.2.2
124
137
  signing_key:
125
138
  specification_version: 4
126
139
  summary: BOSH CPI
@@ -1,106 +0,0 @@
1
- require 'cloud/errors'
2
- require 'httpclient'
3
- require 'base64'
4
- require 'json'
5
-
6
- module Bosh::Cpi
7
- class RegistryClient
8
- attr_reader :endpoint
9
- attr_reader :user
10
- attr_reader :password
11
-
12
- def initialize(endpoint, user, password)
13
- @endpoint = endpoint
14
-
15
- unless @endpoint =~ /^http:\/\//
16
- @endpoint = "http://#{@endpoint}"
17
- end
18
-
19
- @user = user
20
- @password = password
21
-
22
- auth = Base64.encode64("#{@user}:#{@password}").gsub("\n", '')
23
-
24
- @headers = {
25
- "Accept" => 'application/json',
26
- "Authorization" => "Basic #{auth}"
27
- }
28
-
29
- @client = HTTPClient.new
30
- end
31
-
32
- ##
33
- # Update instance settings in the registry
34
- # @param [String] instance_id EC2 instance id
35
- # @param [Hash] settings New agent settings
36
- # @return [Boolean]
37
- def update_settings(instance_id, settings)
38
- unless settings.is_a?(Hash)
39
- raise ArgumentError, "Invalid settings format, Hash expected, #{settings.class} given"
40
- end
41
-
42
- payload = JSON.dump(settings)
43
- url = "#{@endpoint}/instances/#{instance_id}/settings"
44
-
45
- response = @client.put(url, {:body => payload, :header => @headers})
46
-
47
- unless HTTP::Status.successful?(response.status)
48
- cloud_error("Cannot update settings for '#{instance_id}', got HTTP #{response.status}")
49
- end
50
-
51
- true
52
- end
53
-
54
- ##
55
- # Read instance settings from the registry
56
- # @param [String] instance_id EC2 instance id
57
- # @return [Hash] Agent settings
58
- def read_settings(instance_id)
59
- url = "#{@endpoint}/instances/#{instance_id}/settings"
60
-
61
- response = @client.get(url, {:header => @headers})
62
-
63
- if response.status != 200
64
- cloud_error("Cannot read settings for '#{instance_id}', got HTTP #{response.status}")
65
- end
66
-
67
- body = JSON.load(response.body)
68
-
69
- unless body.is_a?(Hash)
70
- cloud_error("Invalid registry response, Hash expected, got #{body.class}: #{body}")
71
- end
72
-
73
- settings = JSON.load(body["settings"])
74
-
75
- unless settings.is_a?(Hash)
76
- cloud_error("Invalid settings format, Hash expected, got #{settings.class}: #{settings}")
77
- end
78
-
79
- settings
80
- rescue JSON::ParserError => e
81
- cloud_error("Cannot parse settings for '#{instance_id}': #{e.message}")
82
- end
83
-
84
- ##
85
- # Delete instance settings from the registry
86
- # @param [String] instance_id EC2 instance id
87
- # @return [Boolean]
88
- def delete_settings(instance_id)
89
- url = "#{@endpoint}/instances/#{instance_id}/settings"
90
-
91
- response = @client.delete(url, {:header => @headers})
92
-
93
- unless [200, 404].include? response.status
94
- cloud_error("Cannot delete settings for '#{instance_id}', got HTTP #{response.status}")
95
- end
96
-
97
- true
98
- end
99
-
100
- private
101
-
102
- def cloud_error(message)
103
- raise Bosh::Clouds::CloudError, message
104
- end
105
- end
106
- end