fog-huaweicloud 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/lib/fog/compute/huaweicloud.rb +1 -1
- data/lib/fog/compute/huaweicloud/models/os_interface.rb +1 -1
- data/lib/fog/compute/huaweicloud/requests/create_os_interface.rb +2 -2
- data/lib/fog/compute/huaweicloud/requests/create_server.rb +1 -1
- data/lib/fog/huaweicloud/core.rb +6 -1
- data/lib/fog/huaweicloud/version.rb +1 -1
- data/lib/fog/network/huaweicloud/models/subnets.rb +4 -4
- data/lib/fog/network/huaweicloud/requests/get_subnet.rb +5 -6
- data/lib/fog/network/huaweicloud/requests/list_subnets.rb +5 -6
- 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: 3658c42ce92b40bc32fe8a49f87b2eeb4e78bc6d
|
4
|
+
data.tar.gz: 99511f7291d1249bcf3d620d538b86cff9191f7a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7be3372fe0f4d9b2e4c36cc6e44eb2c7477a49e23e2a55913df8e34d4bde250af6a22e0ee87ccc986572b0ddafa924ab7d8c2de14f0eee2b0c8ac4abcba2018b
|
7
|
+
data.tar.gz: 7f8a27335479bcf577b310ce5b1cd09d2d3fb7d5580f469c98b5a3cc1b667ab24e76251e8c84fd5f9e2326a7a95d8ed551d654540c0f8cf5f6538bccc4988faf
|
data/CHANGELOG.md
CHANGED
@@ -336,7 +336,7 @@ module Fog
|
|
336
336
|
}
|
337
337
|
],
|
338
338
|
"mac_addr" => "fa:16:3e:4c:2c:30",
|
339
|
-
"
|
339
|
+
"subnet_id" => "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
|
340
340
|
"port_id" => "ce531f90-199f-48c0-816c-13e38010b442",
|
341
341
|
"port_state" => "ACTIVE"
|
342
342
|
}
|
@@ -12,8 +12,8 @@ module Fog
|
|
12
12
|
|
13
13
|
if options[:port_id]
|
14
14
|
body['interfaceAttachment']['port_id'] = options[:port_id]
|
15
|
-
elsif options[:
|
16
|
-
body['interfaceAttachment']['
|
15
|
+
elsif options[:subnet_id]
|
16
|
+
body['interfaceAttachment']['subnet_id'] = options[:subnet_id]
|
17
17
|
end
|
18
18
|
|
19
19
|
if options[:ip_address]
|
@@ -46,7 +46,7 @@ module Fog
|
|
46
46
|
data['server']['networks'] =
|
47
47
|
Array(options['nics']).map do |nic|
|
48
48
|
neti = {}
|
49
|
-
neti['uuid'] = (nic['
|
49
|
+
neti['uuid'] = (nic['subnet_id'] || nic[:subnet_id]) unless (nic['subnet_id'] || nic[:subnet_id]).nil?
|
50
50
|
neti['fixed_ip'] = (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]) unless (nic['v4_fixed_ip'] || nic[:v4_fixed_ip]).nil?
|
51
51
|
neti['port'] = (nic['port_id'] || nic[:port_id]) unless (nic['port_id'] || nic[:port_id]).nil?
|
52
52
|
neti
|
data/lib/fog/huaweicloud/core.rb
CHANGED
@@ -76,9 +76,14 @@ module Fog
|
|
76
76
|
|
77
77
|
private
|
78
78
|
|
79
|
-
def request(params, parse_json = true)
|
79
|
+
def request(params, parse_json = true, overwrite_version={})
|
80
80
|
retried = false
|
81
81
|
begin
|
82
|
+
# NOTE: This is only for transition usage. It should be removed once we upgraded all
|
83
|
+
# the APIs to non-OpenStack version.
|
84
|
+
overwrite_version.each do |key, value|
|
85
|
+
@path.sub!(key, value + "/" + @current_tenant['id']))
|
86
|
+
end
|
82
87
|
response = @connection.request(params.merge(
|
83
88
|
:headers => headers(params.delete(:headers)),
|
84
89
|
:path => "#{@path}/#{params[:path]}"
|
@@ -14,13 +14,13 @@ module Fog
|
|
14
14
|
super
|
15
15
|
end
|
16
16
|
|
17
|
-
def all(filters_arg = filters)
|
17
|
+
def all(filters_arg = filters, openstack_compatible=true)
|
18
18
|
filters = filters_arg
|
19
|
-
load_response(service.list_subnets(filters), 'subnets')
|
19
|
+
load_response(service.list_subnets(filters, openstack_compatible), 'subnets')
|
20
20
|
end
|
21
21
|
|
22
|
-
def get(subnet_id)
|
23
|
-
if subnet = service.get_subnet(subnet_id).body['subnet']
|
22
|
+
def get(subnet_id, openstack_compatible=true)
|
23
|
+
if subnet = service.get_subnet(subnet_id, openstack_compatible).body['subnet']
|
24
24
|
new(subnet)
|
25
25
|
end
|
26
26
|
rescue Fog::Network::HuaweiCloud::NotFound
|
@@ -2,17 +2,16 @@ module Fog
|
|
2
2
|
module Network
|
3
3
|
class HuaweiCloud
|
4
4
|
class Real
|
5
|
-
def get_subnet(subnet_id)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
:path => "subnets/#{subnet_id}"
|
5
|
+
def get_subnet(subnet_id,openstack_compatible = true)
|
6
|
+
overwrite_version = openstack_compatible ? {} : {'v2.0' => 'v1'}
|
7
|
+
request({:expects => [200], :method=> 'GET', :path => "subnets/#{subnet_id}"},
|
8
|
+
true, overwrite_version
|
10
9
|
)
|
11
10
|
end
|
12
11
|
end
|
13
12
|
|
14
13
|
class Mock
|
15
|
-
def get_subnet(subnet_id)
|
14
|
+
def get_subnet(subnet_id, openstack_compatible = true)
|
16
15
|
response = Excon::Response.new
|
17
16
|
if data = self.data[:subnets][subnet_id]
|
18
17
|
response.status = 200
|
@@ -2,18 +2,17 @@ module Fog
|
|
2
2
|
module Network
|
3
3
|
class HuaweiCloud
|
4
4
|
class Real
|
5
|
-
def list_subnets(filters = {})
|
5
|
+
def list_subnets(filters = {}, openstack_compatible = true)
|
6
|
+
overwrite_version = openstack_compatible ? {} : {'v2.0' => 'v1'}
|
6
7
|
request(
|
7
|
-
:expects => 200,
|
8
|
-
|
9
|
-
:path => 'subnets',
|
10
|
-
:query => filters
|
8
|
+
{:expects => 200, :method => 'GET', :path => 'subnets', :query => filters},
|
9
|
+
true, overwrite_version
|
11
10
|
)
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
14
|
class Mock
|
16
|
-
def list_subnets(_filters = {})
|
15
|
+
def list_subnets(_filters = {}, openstack_compatible = true)
|
17
16
|
Excon::Response.new(
|
18
17
|
:body => {'subnets' => data[:subnets].values},
|
19
18
|
:status => 200
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-huaweicloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Huawei
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|