fog-ovirt 0.1.0 → 0.1.1

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: 55093b2fd8fa6266805c6ccfcaa28bd954c726d6
4
- data.tar.gz: 56aa2f5a6715cdde247eb946a494fe20ae744203
3
+ metadata.gz: 0a1489168dab1f5b8e8783a925a0778c0907ad98
4
+ data.tar.gz: 6fc09ad9526f469a56f68932d6f8c8d1c3ffe8f1
5
5
  SHA512:
6
- metadata.gz: 852066b57a8ea9687050c71df830abd8a45a8cc0d80729590b36ad796825eed1c24828eddd0ca374390bbc5711a7d1fda8e41e9a721c9664a3c1b3841b5c0dea
7
- data.tar.gz: 181ee0e2b3d72d7db0cfa52d5e12f4a71b3a3e360b4cd8a47b9b30715c7322fc4009bcd58f2dedf04c222c31280fdf49f5e87c197da778b57537a593fce4ba17
6
+ metadata.gz: 99252e1745a98f1281c696fb1a70971b7425407ebda81dc6150c3d8237a167b9f41f06b530f5e0a6e6a5d35a2a458bf85167383fef4b0154d2607df2105f5729
7
+ data.tar.gz: ae0abe16d0082fbc214788dcd48b65950870c48fe98e119400e4fbd4d571b40240380f84dc82767c1ecdd48f80a578ccd869578431f48af2b549d6f3bd8bed0a
@@ -19,6 +19,8 @@ module Fog
19
19
  collection :clusters
20
20
  model :interface
21
21
  collection :interfaces
22
+ model :operating_system
23
+ collection :operating_systems
22
24
  model :volume
23
25
  collection :volumes
24
26
  model :quota
@@ -70,6 +72,7 @@ module Fog
70
72
  request :destroy_affinity_group
71
73
  request :add_to_affinity_group
72
74
  request :remove_from_affinity_group
75
+ request :list_operating_systems
73
76
 
74
77
  module Shared
75
78
  # converts an OVIRT object into an hash for fog to consume.
@@ -0,0 +1,18 @@
1
+ module Fog
2
+ module Compute
3
+ class Ovirt
4
+ class OperatingSystem < Fog::Model
5
+ attr_accessor :raw
6
+ identity :id
7
+
8
+ attribute :name
9
+ attribute :href
10
+ attribute :description
11
+
12
+ def to_s
13
+ name
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ require 'fog/core/collection'
2
+ require 'fog/ovirt/models/compute/operating_system'
3
+
4
+ module Fog
5
+ module Compute
6
+ class Ovirt
7
+ class OperatingSystems < Fog::Collection
8
+ model Fog::Compute::Ovirt::OperatingSystem
9
+
10
+ def all
11
+ load service.list_operating_systems
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ module Fog
2
+ module Compute
3
+ class Ovirt
4
+ class Real
5
+ def list_operating_systems
6
+ client.operating_systems.map {|ovirt_obj| ovirt_attrs ovirt_obj}
7
+ end
8
+ end
9
+ class Mock
10
+ def list_operating_systems
11
+ xml = read_xml 'operating_systems.xml'
12
+ Nokogiri::XML(xml).xpath('/operating_systems/operating_system').map do |os|
13
+ ovirt_attrs OVIRT::OperatingSystem::new(self, os)
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,10 @@
1
+ <operating_systems>
2
+ <operating_system href="/ovirt-engine/api/v3/operatingsystems/b51fe06a-9483-49e0-9577-9779826e7e82" id="b51fe06a-9483-49e0-9577-9779826e7e82">
3
+ <name>other</name>
4
+ <description>Other OS</description>
5
+ <large_icon href="/ovirt-engine/api/v3/icons/124c94be-be96-4df8-b109-ebf5d3cbf72b"
6
+ id="124c94be-be96-4df8-b109-ebf5d3cbf72b" />
7
+ <small_icon href="/ovirt-engine/api/v3/icons/55c8d56e-2ff0-46ef-aa27-9161db22fe21"
8
+ id="55c8d56e-2ff0-46ef-aa27-9161db22fe21"/>
9
+ </operating_system>
10
+ </operating_systems>
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Ovirt
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
@@ -9,7 +9,7 @@ Shindo.tests('Fog::Compute[:ovirt]', ['ovirt']) do
9
9
  end
10
10
 
11
11
  tests("Compute collections") do
12
- %w{ servers templates clusters interfaces }.each do |collection|
12
+ %w{ servers templates clusters interfaces operating_systems }.each do |collection|
13
13
  test("it should respond to #{collection}") { compute.respond_to? collection }
14
14
  end
15
15
  end
@@ -0,0 +1,29 @@
1
+ Shindo.tests('Fog::Compute[:ovirt] | operating_system model', ['ovirt']) do
2
+
3
+ operating_systems = Fog::Compute[:ovirt].operating_systems
4
+ operating_system = operating_systems.last
5
+
6
+ tests('The operating_system model should') do
7
+ tests('have attributes') do
8
+ model_attribute_hash = operating_system.attributes
9
+ attributes = [ :id,
10
+ :name,
11
+ :href,
12
+ :description
13
+ ]
14
+
15
+ tests("The operating_system model should respond to") do
16
+ attributes.each do |attribute|
17
+ test("#{attribute}") { operating_system.respond_to? attribute }
18
+ end
19
+ end
20
+ tests("The attributes hash should have key") do
21
+ attributes.each do |attribute|
22
+ test("#{attribute}") { model_attribute_hash.key? attribute }
23
+ end
24
+ end
25
+ end
26
+ test('be a kind of Fog::Compute::Ovirt::OperatingSystem') { operating_system.kind_of? Fog::Compute::Ovirt::OperatingSystem }
27
+ end
28
+
29
+ end
@@ -0,0 +1,10 @@
1
+ Shindo.tests('Fog::Compute[:ovirt] | operating_systems collection', ['ovirt']) do
2
+
3
+ operating_systems = Fog::Compute[:ovirt].operating_systems
4
+
5
+ tests('The servers collection') do
6
+ test('should not be empty') { not operating_systems.empty? }
7
+ test('should be a kind of Fog::Compute::Ovirt::OperatingSystems') { operating_systems.kind_of? Fog::Compute::Ovirt::OperatingSystems }
8
+ end
9
+
10
+ end
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: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ori Rabin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-31 00:00:00.000000000 Z
11
+ date: 2017-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core
@@ -164,6 +164,8 @@ files:
164
164
  - lib/fog/ovirt/models/compute/instance_types.rb
165
165
  - lib/fog/ovirt/models/compute/interface.rb
166
166
  - lib/fog/ovirt/models/compute/interfaces.rb
167
+ - lib/fog/ovirt/models/compute/operating_system.rb
168
+ - lib/fog/ovirt/models/compute/operating_systems.rb
167
169
  - lib/fog/ovirt/models/compute/quota.rb
168
170
  - lib/fog/ovirt/models/compute/quotas.rb
169
171
  - lib/fog/ovirt/models/compute/server.rb
@@ -198,6 +200,7 @@ files:
198
200
  - lib/fog/ovirt/requests/compute/list_clusters.rb
199
201
  - lib/fog/ovirt/requests/compute/list_instance_types.rb
200
202
  - lib/fog/ovirt/requests/compute/list_networks.rb
203
+ - lib/fog/ovirt/requests/compute/list_operating_systems.rb
201
204
  - lib/fog/ovirt/requests/compute/list_quotas.rb
202
205
  - lib/fog/ovirt/requests/compute/list_template_interfaces.rb
203
206
  - lib/fog/ovirt/requests/compute/list_template_volumes.rb
@@ -216,6 +219,7 @@ files:
216
219
  - lib/fog/ovirt/requests/compute/mock_files/instance_type.xml
217
220
  - lib/fog/ovirt/requests/compute/mock_files/instance_types.xml
218
221
  - lib/fog/ovirt/requests/compute/mock_files/nics.xml
222
+ - lib/fog/ovirt/requests/compute/mock_files/operating_systems.xml
219
223
  - lib/fog/ovirt/requests/compute/mock_files/quotas.xml
220
224
  - lib/fog/ovirt/requests/compute/mock_files/storage_domains.xml
221
225
  - lib/fog/ovirt/requests/compute/mock_files/template.xml
@@ -242,6 +246,8 @@ files:
242
246
  - tests/ovirt/models/compute/clusters_tests.rb
243
247
  - tests/ovirt/models/compute/interface_tests.rb
244
248
  - tests/ovirt/models/compute/interfaces_tests.rb
249
+ - tests/ovirt/models/compute/operating_system_tests.rb
250
+ - tests/ovirt/models/compute/operating_systems_tests.rb
245
251
  - tests/ovirt/models/compute/server_tests.rb
246
252
  - tests/ovirt/models/compute/servers_tests.rb
247
253
  - tests/ovirt/models/compute/template_tests.rb
@@ -286,6 +292,8 @@ test_files:
286
292
  - tests/ovirt/models/compute/clusters_tests.rb
287
293
  - tests/ovirt/models/compute/interface_tests.rb
288
294
  - tests/ovirt/models/compute/interfaces_tests.rb
295
+ - tests/ovirt/models/compute/operating_system_tests.rb
296
+ - tests/ovirt/models/compute/operating_systems_tests.rb
289
297
  - tests/ovirt/models/compute/server_tests.rb
290
298
  - tests/ovirt/models/compute/servers_tests.rb
291
299
  - tests/ovirt/models/compute/template_tests.rb