openstack 3.3.12 → 3.3.13

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: a1054a64a8c43aee53a7345f20317b2c0c404730
4
- data.tar.gz: a8b99e8db8cff26281cd96942236ae66aa053d3a
3
+ metadata.gz: 42ac11d43042dcced4aed85521c417c746d33daa
4
+ data.tar.gz: 8c19d56848b36ca0c2088f4950eb6fa360ded969
5
5
  SHA512:
6
- metadata.gz: 2e5961bf60a7eba69688aa59c56bfb95eea199d93be3e1741c52ea32e55f8c17b0f8a0ffd870ff169cec16905173521e5d018faff2ad2d896c4680564080993b
7
- data.tar.gz: 96615179d09dc038e02a0b8ef050bec65d5ac25f62453fa344eeb3f7793975b156019e0727b1f27a54171a8213510abc11d888f2288a422e6680dfaa98e724ac
6
+ metadata.gz: fd84bcbd0d4d87b22a97c1f517e1ad3d4a247be3fd89d0e7f4c7d8e0a45b9835b16b32a8676e0aa52778fa115e71d9f045704a9dce92e5a98c8dcde6bfb19e29
7
+ data.tar.gz: 2b5b88312335c28b0ff43c24da06e0e350d4ebf388529259dd0bf9435e02f37d122488659961e5eb19fdc3cb8a9674eb605f67ac56e3c65fbe08fa8e706de444
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.3.12
1
+ 3.3.13
@@ -7,6 +7,8 @@ module OpenStack
7
7
  require 'rubygems'
8
8
  require 'json'
9
9
  require 'date'
10
+ require 'securerandom'
11
+ require 'logger'
10
12
 
11
13
  unless "".respond_to? :each_char
12
14
  require "jcode"
@@ -122,6 +122,7 @@ class Connection
122
122
  @user_domain = options[:user_domain] || nil
123
123
  @project_id = options[:project_id] || nil
124
124
  @project_name = options[:project_name] || nil
125
+ @logger = options[:logger] || nil
125
126
  @project_domain_name = options[:project_domain_name] || nil
126
127
  @project_domain_id = options[:project_domain_id] || nil
127
128
  @domain_name = options[:domain_name] || nil
@@ -200,6 +201,10 @@ class Connection
200
201
  tries = @retries
201
202
  time = 3
202
203
 
204
+ request_id = SecureRandom.uuid
205
+ started_timestamp = Time.now.to_f * 1000
206
+ log_request(request_id, "REQUEST: #{method.to_s} => #{scheme}://#{server}#{path}")
207
+
203
208
  hdrhash = headerprep(headers)
204
209
  start_http(server,path,port,scheme,hdrhash)
205
210
  request = Net::HTTP.const_get(method.to_s.capitalize).new(path,hdrhash)
@@ -213,6 +218,7 @@ class Connection
213
218
  else
214
219
  response = @http[server].request(request)
215
220
  end
221
+ log_request(request_id, "RESPONSE: Code => #{response.code} Time => #{(Time.now.to_f * 1000) - started_timestamp}ms")
216
222
  if @is_debug
217
223
  puts "REQUEST: #{method.to_s} => #{scheme}://#{server}#{path}"
218
224
  puts data if data
@@ -250,6 +256,12 @@ class Connection
250
256
 
251
257
  private
252
258
 
259
+ def log_request(request_id, message)
260
+ if @logger.kind_of?(Logger)
261
+ @logger.info("#{request_id} - #{message}")
262
+ end
263
+ end
264
+
253
265
  # Sets up standard HTTP headers
254
266
  def headerprep(headers = {}) # :nodoc:
255
267
  default_headers = {}
@@ -1,34 +1,37 @@
1
1
  module OpenStack
2
- module Network
3
- class Port
2
+ module Network
3
+ class Port
4
4
 
5
- attr_reader :id
6
- attr_reader :network_id
7
- attr_reader :name
8
- attr_reader :admin_state_up
9
- attr_reader :status
10
- attr_reader :mac_address
11
- attr_reader :fixed_ips
12
- attr_reader :device_id
13
- attr_reader :device_owner
14
- attr_reader :tenant_id
15
- attr_reader :qos_policy_id
16
-
17
- def initialize(port_hash={})
18
- @id = port_hash["id"]
19
- @network_id = port_hash["network_id"]
20
- @name = port_hash["name"]
21
- @admin_state_up = port_hash["admin_state_up"]
22
- @status = port_hash["status"]
23
- @mac_address = port_hash["mac_address"]
24
- @fixed_ips = port_hash["fixed_ips"]
25
- @device_id = port_hash["device_id"]
26
- @device_owner = port_hash["device_owner"]
27
- @tenant_id = port_hash["tenant_id"]
28
- @qos_policy_id = port_hash["qos_policy_id"]
29
- end
5
+ attr_reader :id
6
+ attr_reader :network_id
7
+ attr_reader :name
8
+ attr_reader :admin_state_up
9
+ attr_reader :status
10
+ attr_reader :mac_address
11
+ attr_reader :fixed_ips
12
+ attr_reader :device_id
13
+ attr_reader :device_owner
14
+ attr_reader :tenant_id
15
+ attr_reader :qos_policy_id
16
+ attr_reader :allowed_address_pairs
17
+ attr_reader :updated_at
30
18
 
19
+ def initialize(port_hash={})
20
+ @id = port_hash["id"]
21
+ @network_id = port_hash["network_id"]
22
+ @name = port_hash["name"]
23
+ @admin_state_up = port_hash["admin_state_up"]
24
+ @status = port_hash["status"]
25
+ @mac_address = port_hash["mac_address"]
26
+ @fixed_ips = port_hash["fixed_ips"]
27
+ @device_id = port_hash["device_id"]
28
+ @device_owner = port_hash["device_owner"]
29
+ @tenant_id = port_hash["tenant_id"]
30
+ @qos_policy_id = port_hash["qos_policy_id"]
31
+ @allowed_address_pairs = port_hash["allowed_address_pairs"]
32
+ @updated_at = port_hash["updated_at"]
33
+ end
31
34
 
35
+ end
32
36
  end
33
37
  end
34
- end
@@ -52,8 +52,13 @@ module Volume
52
52
  end
53
53
  alias :volume :get_volume
54
54
 
55
- def delete_volume(vol_id)
56
- response = @connection.req("DELETE", "/#{@volume_path}/#{vol_id}")
55
+ def delete_volume(vol_id, force = false)
56
+ if force
57
+ data = JSON.generate({'os-force_delete' => {}})
58
+ @connection.req("POST", "/#{@volume_path}/#{vol_id}/action", {data: data})
59
+ else
60
+ @connection.req("DELETE", "/#{@volume_path}/#{vol_id}")
61
+ end
57
62
  true
58
63
  end
59
64
 
@@ -13,6 +13,7 @@ module OpenStack
13
13
  attr_reader :snapshot_id
14
14
  attr_reader :attachments
15
15
  attr_reader :created_at
16
+ attr_reader :updated_at
16
17
  attr_reader :status
17
18
 
18
19
  def initialize(connection, volume_info)
@@ -37,6 +38,7 @@ module OpenStack
37
38
  @snapshot_id = volume_info["snapshot_id"] || volume_info["snapshotId"]
38
39
  @attachments = volume_info["attachments"]
39
40
  @created_at = volume_info["created_at"] || volume_info["createdAt"]
41
+ @updated_at = volume_info["updated_at"]
40
42
  @status = volume_info["status"]
41
43
  end
42
44
 
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: 3.3.12
4
+ version: 3.3.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Prince
@@ -138,7 +138,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  version: '0'
139
139
  requirements: []
140
140
  rubyforge_project:
141
- rubygems_version: 2.6.8
141
+ rubygems_version: 2.6.14
142
142
  signing_key:
143
143
  specification_version: 4
144
144
  summary: OpenStack Ruby API