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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 073897e81a5750e2b73cfcf2019d1515f6bf174e
4
- data.tar.gz: f174d120d9376189cc3905ca70675a80776d7e16
3
+ metadata.gz: 3658c42ce92b40bc32fe8a49f87b2eeb4e78bc6d
4
+ data.tar.gz: 99511f7291d1249bcf3d620d538b86cff9191f7a
5
5
  SHA512:
6
- metadata.gz: 095e90b2e07b86aa5866fee0e71485a2f3cbdc97fd4d0dcd53f235a2ad369bd0548e4d7a8794c027db7fa9edd72d28b89450dc60b32ba5f9fc512f8e2702e570
7
- data.tar.gz: 46ae77270c82fd44c3143ed9a3ac39e217be21ff9640f212a56196060d8aad45e931f87443b2b4f993c5cd8d7b59386b977bbfda865f8417351f0ef80829ece1
6
+ metadata.gz: 7be3372fe0f4d9b2e4c36cc6e44eb2c7477a49e23e2a55913df8e34d4bde250af6a22e0ee87ccc986572b0ddafa924ab7d8c2de14f0eee2b0c8ac4abcba2018b
7
+ data.tar.gz: 7f8a27335479bcf577b310ce5b1cd09d2d3fb7d5580f469c98b5a3cc1b667ab24e76251e8c84fd5f9e2326a7a95d8ed551d654540c0f8cf5f6538bccc4988faf
@@ -44,4 +44,4 @@
44
44
  ## Compute
45
45
 
46
46
  * create_server and the Server model where updated to allow booting a VM
47
- with NICs (net_id, port_id, fixed_ip).
47
+ with NICs (subnet_id, port_id, fixed_ip).
@@ -336,7 +336,7 @@ module Fog
336
336
  }
337
337
  ],
338
338
  "mac_addr" => "fa:16:3e:4c:2c:30",
339
- "net_id" => "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
339
+ "subnet_id" => "3cb9bc59-5699-4588-a4b1-b87f96708bc6",
340
340
  "port_id" => "ce531f90-199f-48c0-816c-13e38010b442",
341
341
  "port_state" => "ACTIVE"
342
342
  }
@@ -7,7 +7,7 @@ module Fog
7
7
  identity :port_id
8
8
  attribute :fixed_ips, :type => :array
9
9
  attribute :mac_addr
10
- attribute :net_id
10
+ attribute :subnet_id
11
11
  attribute :port_state
12
12
  end
13
13
  end
@@ -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[:net_id]
16
- body['interfaceAttachment']['net_id'] = options[:net_id]
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['net_id'] || nic[:net_id]) unless (nic['net_id'] || nic[:net_id]).nil?
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
@@ -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]}"
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module HuaweiCloud
3
- VERSION = '0.1.2'.freeze
3
+ VERSION = '0.1.3'.freeze
4
4
  end
5
5
  end
@@ -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
- request(
7
- :expects => [200],
8
- :method => 'GET',
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
- :method => 'GET',
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.2
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-07-31 00:00:00.000000000 Z
11
+ date: 2018-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core