openstack 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +10 -0
- data/VERSION +1 -1
- data/lib/openstack/compute/server.rb +3 -1
- data/lib/openstack/connection.rb +12 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -44,6 +44,16 @@ Other parameters for the create method:
|
|
44
44
|
irb(main):006:0> os.containers
|
45
45
|
=> ["herpy_Foo_container", "derpy_bar_bucket"]
|
46
46
|
|
47
|
+
irb(main):003:0> os.connection.regions_list
|
48
|
+
=> {"region-a.geo-1" => [ {:service=>"object-store", :versionId=>"1.0"}, {:service=>"identity", :versionId=>"2.0"}],
|
49
|
+
"region-b.geo-1"=>[{:service=>"identity", :versionId=>"2.0"}],
|
50
|
+
"az-2.region-a.geo-1"=>[{:service=>"image", :versionId=>"1.0"}, {:service=>"volume", :versionId=>"1.1"}, {:service=>"compute", :versionId=>"1.1"}],
|
51
|
+
"az-1.region-a.geo-1"=>[{:service=>"image", :versionId=>"1.0"}, {:service=>"volume", :versionId=>"1.1"}, {:service=>"compute", :versionId=>"1.1"}]}
|
52
|
+
|
53
|
+
irb(main):005:0> os.connection.regions_list["region-a.geo-1"]
|
54
|
+
=> [{:service=>"object-store", :versionId=>"1.0"}, {:service=>"identity", :versionId=>"2.0"}]
|
55
|
+
|
56
|
+
|
47
57
|
== Examples
|
48
58
|
|
49
59
|
== For Compute:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.9
|
@@ -17,6 +17,7 @@ module Compute
|
|
17
17
|
attr_reader :metadata
|
18
18
|
attr_accessor :adminPass
|
19
19
|
attr_reader :key_name
|
20
|
+
attr_reader :created
|
20
21
|
attr_reader :security_groups
|
21
22
|
|
22
23
|
# This class is the representation of a single Server object. The constructor finds the server identified by the specified
|
@@ -64,6 +65,7 @@ module Compute
|
|
64
65
|
@image = data["image"] || data["imageId"]
|
65
66
|
@flavor = data["flavor"] || data["flavorId"]
|
66
67
|
@key_name = data["key_name"] # if provider uses the keys API extension for accessing servers
|
68
|
+
@created = data["created"]
|
67
69
|
@security_groups = (data["security_groups"] || []).inject([]){|res, c| res << c["id"] ; res}
|
68
70
|
true
|
69
71
|
end
|
@@ -177,7 +179,7 @@ module Compute
|
|
177
179
|
data = JSON.generate(:createImage => options)
|
178
180
|
response = @compute.connection.csreq("POST",@svrmgmthost,"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/action",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)
|
179
181
|
OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)
|
180
|
-
image_id = response["Location"].
|
182
|
+
image_id = response["Location"].split("/images/").last
|
181
183
|
OpenStack::Compute::Image.new(@compute, image_id)
|
182
184
|
end
|
183
185
|
|
data/lib/openstack/connection.rb
CHANGED
@@ -21,6 +21,7 @@ class Connection
|
|
21
21
|
attr_reader :proxy_host
|
22
22
|
attr_reader :proxy_port
|
23
23
|
attr_reader :region
|
24
|
+
attr_reader :regions_list #e.g. os.connection.regions_list == {"region-a.geo-1" => [ {:service=>"object-store", :versionId=>"1.0"}, {:service=>"identity", :versionId=>"2.0"}], "region-b.geo-1"=>[{:service=>"identity", :versionId=>"2.0"}] }
|
24
25
|
|
25
26
|
attr_reader :http
|
26
27
|
attr_reader :is_debug
|
@@ -83,6 +84,7 @@ class Connection
|
|
83
84
|
@service_name = options[:service_name] || nil
|
84
85
|
@service_type = options[:service_type] || "compute"
|
85
86
|
@region = options[:region] || @region = nil
|
87
|
+
@regions_list = {} # this is populated during authentication - from the returned service catalogue
|
86
88
|
@is_debug = options[:is_debug]
|
87
89
|
auth_uri=nil
|
88
90
|
begin
|
@@ -282,7 +284,16 @@ class AuthV20
|
|
282
284
|
raise OpenStack::Exception::NotImplemented.new("The requested service: \"#{connection.service_type}\" is not present " +
|
283
285
|
"in the returned service catalogue.", 501, "#{resp_data["access"]["serviceCatalog"]}") unless implemented_services.include?(connection.service_type)
|
284
286
|
resp_data['access']['serviceCatalog'].each do |service|
|
285
|
-
|
287
|
+
service["endpoints"].each do |endpoint|
|
288
|
+
connection.regions_list[endpoint["region"]] ||= []
|
289
|
+
connection.regions_list[endpoint["region"]] << {:service=>service["type"], :versionId => endpoint["versionId"]}
|
290
|
+
end
|
291
|
+
if connection.service_name
|
292
|
+
check_service_name = connection.service_name
|
293
|
+
else
|
294
|
+
check_service_name = service['name']
|
295
|
+
end
|
296
|
+
if service['type'] == connection.service_type and service['name'] == check_service_name
|
286
297
|
endpoints = service["endpoints"]
|
287
298
|
if connection.region
|
288
299
|
endpoints.each do |ep|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-02-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: mocha
|