fog-ovirt 1.2.2 → 1.2.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
  SHA256:
3
- metadata.gz: 62f57ba56922d0b42dcb1630ca68d8eeaddadb546af155531f067cb69a827f6c
4
- data.tar.gz: 8cd2223ae09ba6b051766f3c2adf16f16108aa62054809a2a67bc8d9a701b1f0
3
+ metadata.gz: 9035effc2ab1bfc2040120139b903ab93f9c981dc0f5ce34540d8ab1dbe3d5f3
4
+ data.tar.gz: 2fd5d0441dba96b14a7ce3bf673531c602094f05ecc1e6f42d1a63f7474398f3
5
5
  SHA512:
6
- metadata.gz: 01da7011f032c165a82bd81fee927aa1692c5e5f47f6d3a4ff9520d6e2dce4eb05c5b63ce03fe31104da8cf50ab9f1c6416411daf74421e454b5dd4906271e74
7
- data.tar.gz: 627e9e59398bd1a035d9e9d93fee254830dd57308d41652a2ad61a6f8c4027e9a0950a3ccd0eef14314e4384a3e6e1bea26720b2aadf13a89cb504eb72075b6a
6
+ metadata.gz: a06c551b333e792e26b0634d7b9613536c070451d13590435cf03c1b471f7cabdbef0cb97afc72a377cded5f08974ddde79ab99d3558f1b5c0d78d0a6394d2b7
7
+ data.tar.gz: 12dad14839f2e98b11211cbf9115cd822fd2c82be4abd39b9413c9dc42a1b412f73ad8e5de7191dc26ffea6cc750b69e88f452bf885962d6bf49863779d616b3
@@ -44,7 +44,7 @@ module Fog
44
44
  module Shared
45
45
  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
46
46
  # converts an OVIRT object into an hash for fog to consume.
47
- def ovirt_attrs(obj)
47
+ def shared_ovirt_attrs(obj)
48
48
  opts = {}
49
49
  # TODO: stop using instance_variables, they will change
50
50
  obj.instance_variables.each do |v|
@@ -52,7 +52,7 @@ module Fog
52
52
  value = obj.instance_variable_get(v)
53
53
 
54
54
  if key == :network
55
- opts[key] = obj.vnic_profile.present? ? client.follow_link(obj.vnic_profile).network.id : value
55
+ opts[key] = obj.vnic_profile.present? ? yield(obj) : value
56
56
  next
57
57
  end
58
58
 
@@ -70,6 +70,7 @@ module Fog
70
70
  end
71
71
  opts
72
72
  end
73
+
73
74
  # rubocop:enable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
74
75
 
75
76
  # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
@@ -138,6 +139,13 @@ module Fog
138
139
  require "ovirtsdk4"
139
140
  end
140
141
 
142
+ def ovirt_attrs(obj)
143
+ shared_ovirt_attrs(obj) do
144
+ xml = read_xml("vnic_profile.xml")
145
+ Nokogiri::XML(xml).xpath("/vnic_profile/network/@id").to_s
146
+ end
147
+ end
148
+
141
149
  private
142
150
 
143
151
  def client
@@ -177,17 +185,23 @@ module Fog
177
185
  end
178
186
  # rubocop:enable Metrics/AbcSize
179
187
 
188
+ def ovirt_attrs(obj)
189
+ shared_ovirt_attrs(obj) do
190
+ client.follow_link(obj.vnic_profile).network.id
191
+ end
192
+ end
193
+
180
194
  def api_version
181
195
  api = client.system_service.get
182
196
  api.product_info.version.full_version
183
197
  end
184
198
 
185
199
  def datacenter
186
- @datacenter ||= datacenter_hash[:id]
200
+ datacenter_hash[:id]
187
201
  end
188
202
 
189
203
  def datacenter_hash
190
- @datacenter_hash ||= datacenters.find { |x| x[:id] == @datacenter } if @datacenter
204
+ @datacenter_hash ||= datacenters.find { |x| x[:id] == @datacenter } || datacenters.find { |x| x[:name] == @datacenter } if @datacenter
191
205
  @datacenter_hash ||= datacenters.first
192
206
  end
193
207
 
@@ -17,6 +17,7 @@ module Fog
17
17
  attribute :quota
18
18
  attribute :alias
19
19
  attribute :wipe_after_delete
20
+ attribute :name
20
21
 
21
22
  def size_gb
22
23
  attributes[:size_gb] ||= attributes[:size].to_i / Fog::Ovirt::Compute::DISK_SIZE_TO_GB if attributes[:size]
@@ -0,0 +1,10 @@
1
+ <vnic_profile href="/ovirt-engine/api/vnicprofiles/0000000a-000a-000a-000a-000000000398" id="0000000a-000a-000a-000a-000000000398">
2
+ <name>ovirtmgmt</name>
3
+ <link href="/ovirt-engine/api/vnicprofiles/0000000a-000a-000a-000a-000000000398/permissions" rel="permissions"/>
4
+ <pass_through>
5
+ <mode>disabled</mode>
6
+ </pass_through>
7
+ <port_mirroring>false</port_mirroring>
8
+ <network href="/ovirt-engine/api/networks/00000000-0000-0000-0000-000000000009" id="00000000-0000-0000-0000-000000000009"/>
9
+ <network_filter href="/ovirt-engine/api/networkfilters/593567f3-0314-011f-020e-0000000002d2" id="593567f3-0314-011f-020e-0000000002d2"/>
10
+ </vnic_profile>
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Ovirt
3
- VERSION = "1.2.2".freeze
3
+ VERSION = "1.2.3".freeze
4
4
  end
5
5
  end
@@ -2,7 +2,7 @@ Shindo.tests("Fog::Ovirt::Compute.new | client", ["ovirt"]) do
2
2
  before do
3
3
  @client_mock = Object.new
4
4
  def @client_mock.foo
5
- raise OVIRT::OvirtException, "Test"
5
+ raise ::Fog::Ovirt::Errors::OvirtError, "Test"
6
6
  end
7
7
 
8
8
  @object_under_test = Fog::Ovirt::Compute::ExceptionWrapper.new(@client_mock)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-ovirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ori Rabin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-10 00:00:00.000000000 Z
11
+ date: 2019-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -298,6 +298,7 @@ files:
298
298
  - lib/fog/ovirt/requests/compute/v4/mock_files/templates.xml
299
299
  - lib/fog/ovirt/requests/compute/v4/mock_files/vm.xml
300
300
  - lib/fog/ovirt/requests/compute/v4/mock_files/vms.xml
301
+ - lib/fog/ovirt/requests/compute/v4/mock_files/vnic_profile.xml
301
302
  - lib/fog/ovirt/requests/compute/v4/mock_files/volumes.xml
302
303
  - lib/fog/ovirt/requests/compute/v4/storage_domains.rb
303
304
  - lib/fog/ovirt/requests/compute/v4/update_interface.rb