openstack 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.3
1
+ 1.0.4
@@ -54,15 +54,15 @@ module Compute
54
54
  OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)
55
55
  data = JSON.parse(response.body)["server"]
56
56
  end
57
- @id = data["uuid"]
57
+ @id = data["id"] || data["uuid"]
58
58
  @name = data["name"]
59
59
  @status = data["status"]
60
60
  @progress = data["progress"]
61
61
  @addresses = get_addresses(data["addresses"])
62
62
  @metadata = OpenStack::Compute::Metadata.new(@compute, path, data["metadata"])
63
63
  @hostId = data["hostId"]
64
- @image = data["image"]
65
- @flavor = data["flavor"]
64
+ @image = data["image"] || data["imageId"]
65
+ @flavor = data["flavor"] || data["flavorId"]
66
66
  @key_name = data["key_name"] # if provider uses the keys API extension for accessing servers
67
67
  @security_groups = (data["security_groups"] || []).inject([]){|res, c| res << c["id"] ; res}
68
68
  true
@@ -100,7 +100,6 @@ class Connection
100
100
 
101
101
  #specialised from of csreq for PUT object... uses body_stream if possible
102
102
  def put_object(server,path,port,scheme,headers = {},data = nil,attempts = 0) # :nodoc:
103
- start = Time.now
104
103
  if data.respond_to? :read
105
104
  headers['Transfer-Encoding'] = 'chunked'
106
105
  hdrhash = headerprep(headers)
@@ -139,7 +138,6 @@ class Connection
139
138
 
140
139
  # This method actually makes the HTTP REST calls out to the server
141
140
  def csreq(method,server,path,port,scheme,headers = {},data = nil,attempts = 0, &block) # :nodoc:
142
- start = Time.now
143
141
  hdrhash = headerprep(headers)
144
142
  start_http(server,path,port,scheme,hdrhash)
145
143
  request = Net::HTTP.const_get(method.to_s.capitalize).new(path,hdrhash)
@@ -304,7 +302,7 @@ class AuthV20
304
302
  connection.authtoken = false
305
303
  raise OpenStack::Exception::Authentication, "Authentication failed with response code #{response.code}"
306
304
  end
307
- server.finish
305
+ server.finish if server.started?
308
306
  end
309
307
  end
310
308
 
@@ -448,7 +446,7 @@ class Exception
448
446
  # "404 Not Found\n\nThe resource could not be found.\n\n "
449
447
  # which doesn't parse. Deal with such cases here if possible (JSON::ParserError)
450
448
  def self.deal_with_faulty_error(response, parse_error)
451
- case response.code
449
+ case response.code
452
450
  when "404"
453
451
  klass = self.const_get("ItemNotFound")
454
452
  msg = "The resource could not be found"
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.3
4
+ version: 1.0.4
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: 2012-08-24 00:00:00.000000000 Z
13
+ date: 2012-09-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json