openstack 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/openstack/compute/server.rb +41 -0
- data/lib/openstack/connection.rb +2 -2
- data/lib/openstack/network/connection.rb +7 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f940cf6bc01a020ddb4345dbf7ae6798ce0bd8b
|
4
|
+
data.tar.gz: cd2a03fe4608caae58491447706b22cd42c44273
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4bb1ea6325b7b82680150f7099c1907a58228e95858bfb6dda7b9778d0fd3aba6de578a272fb1fc6028f6479805d30f4b4ddd614ad4a2dd6d4d5b485c4d4f6ab
|
7
|
+
data.tar.gz: c5dd47cab514c44a80608e90f294c7f2d7c990218ab6f90c0e74a31924f3a83c4fe8fe6ed07d4aef4888a96dee712663e3e9b25102d78ac06bcdfa3145c39f2b
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.1.0
|
@@ -349,6 +349,47 @@ module Compute
|
|
349
349
|
true
|
350
350
|
end
|
351
351
|
|
352
|
+
# Lists all interfaces from this server.
|
353
|
+
#
|
354
|
+
# >> server.interface_list
|
355
|
+
# => array
|
356
|
+
def interface_list
|
357
|
+
response = @compute.connection.csreq("GET",@svrmgmthost,"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/os-interface",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'})
|
358
|
+
OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)
|
359
|
+
JSON::parse(response.body)["interfaceAttachments"]
|
360
|
+
end
|
361
|
+
|
362
|
+
# Returns all details about the interface on this server.
|
363
|
+
#
|
364
|
+
# >> server.interface_list
|
365
|
+
# => array
|
366
|
+
def interface_list(id)
|
367
|
+
response = @compute.connection.csreq("GET",@svrmgmthost,"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/os-interface/#{id}",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'})
|
368
|
+
OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)
|
369
|
+
JSON::parse(response.body)["interfaceAttachment"]
|
370
|
+
end
|
371
|
+
|
372
|
+
# Creates a new interface on this server.
|
373
|
+
#
|
374
|
+
# >> server.interface_create
|
375
|
+
# => array
|
376
|
+
def interface_create(options)
|
377
|
+
data = JSON.generate(:interfaceAttachment => options)
|
378
|
+
response = @compute.connection.csreq("POST",@svrmgmthost,"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/os-interface",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'},data)
|
379
|
+
OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)
|
380
|
+
JSON::parse(response.body)["interfaceAttachment"]
|
381
|
+
end
|
382
|
+
|
383
|
+
# Deleted a specific interface from this server.
|
384
|
+
#
|
385
|
+
# >> server.interface_delete
|
386
|
+
# => true
|
387
|
+
def interface_delete(id)
|
388
|
+
response = @compute.connection.csreq("DELETE",@svrmgmthost,"#{@svrmgmtpath}/servers/#{URI.encode(self.id.to_s)}/os-interface/#{id}",@svrmgmtport,@svrmgmtscheme,{'content-type' => 'application/json'})
|
389
|
+
OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)
|
390
|
+
true
|
391
|
+
end
|
392
|
+
|
352
393
|
end
|
353
394
|
end
|
354
395
|
end
|
data/lib/openstack/connection.rb
CHANGED
@@ -211,7 +211,7 @@ class Connection
|
|
211
211
|
response = @http[server].request(request)
|
212
212
|
end
|
213
213
|
if @is_debug
|
214
|
-
puts "REQUEST: #{method.to_s} => #{path}"
|
214
|
+
puts "REQUEST: #{method.to_s} => #{scheme}://#{server}#{path}"
|
215
215
|
puts data if data
|
216
216
|
puts "RESPONSE: #{response.body}"
|
217
217
|
puts '----------------------------------------'
|
@@ -240,7 +240,7 @@ class Connection
|
|
240
240
|
headers = options[:headers] || {'content-type' => 'application/json'}
|
241
241
|
data = options[:data]
|
242
242
|
attempts = options[:attempts] || 0
|
243
|
-
path = @service_path + @quantum_version.to_s + path
|
243
|
+
path = (@service_path.empty? ? "/" : @service_path) + @quantum_version.to_s + path
|
244
244
|
res = csreq(method,server,path,port,scheme,headers,data,attempts)
|
245
245
|
res.code.match(/^20.$/) ? (return res) : OpenStack::Exception.raise_exception(res)
|
246
246
|
end
|
@@ -91,6 +91,13 @@ module Network
|
|
91
91
|
OpenStack::Network::Port.new(JSON.parse(response.body)["port"])
|
92
92
|
end
|
93
93
|
|
94
|
+
def update_port(id, options)
|
95
|
+
data = JSON.generate(:port => options)
|
96
|
+
response = @connection.req("PUT", "/ports/#{id}", {:data => data})
|
97
|
+
OpenStack::Exception.raise_exception(response) unless response.code.match(/^20.$/)
|
98
|
+
OpenStack::Network::Port.new(JSON.parse(response.body)["port"])
|
99
|
+
end
|
100
|
+
|
94
101
|
def delete_port(id)
|
95
102
|
@connection.req("DELETE", "/ports/#{id}")
|
96
103
|
true
|
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.
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Prince
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2016-09-
|
15
|
+
date: 2016-09-15 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: mocha
|