fog-ovirt 2.0.2 → 2.0.3

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fog/ovirt/compute/v4.rb +2 -1
  3. data/lib/fog/ovirt/models/compute/interface.rb +1 -0
  4. data/lib/fog/ovirt/models/compute/operating_system.rb +1 -0
  5. data/lib/fog/ovirt/models/compute/server.rb +18 -10
  6. data/lib/fog/ovirt/models/compute/template.rb +16 -8
  7. data/lib/fog/ovirt/models/compute/volume.rb +1 -0
  8. data/lib/fog/ovirt/requests/compute/v4/get_api_version.rb +1 -0
  9. data/lib/fog/ovirt/requests/compute/v4/get_cluster.rb +1 -0
  10. data/lib/fog/ovirt/requests/compute/v4/get_instance_type.rb +1 -0
  11. data/lib/fog/ovirt/requests/compute/v4/get_quota.rb +1 -0
  12. data/lib/fog/ovirt/requests/compute/v4/get_template.rb +1 -0
  13. data/lib/fog/ovirt/requests/compute/v4/get_virtual_machine.rb +1 -0
  14. data/lib/fog/ovirt/requests/compute/v4/get_volume.rb +1 -0
  15. data/lib/fog/ovirt/requests/compute/v4/list_clusters.rb +1 -0
  16. data/lib/fog/ovirt/requests/compute/v4/list_instance_types.rb +1 -0
  17. data/lib/fog/ovirt/requests/compute/v4/list_networks.rb +1 -0
  18. data/lib/fog/ovirt/requests/compute/v4/list_operating_systems.rb +1 -0
  19. data/lib/fog/ovirt/requests/compute/v4/list_quotas.rb +1 -0
  20. data/lib/fog/ovirt/requests/compute/v4/list_template_interfaces.rb +1 -0
  21. data/lib/fog/ovirt/requests/compute/v4/list_template_volumes.rb +1 -0
  22. data/lib/fog/ovirt/requests/compute/v4/list_templates.rb +1 -0
  23. data/lib/fog/ovirt/requests/compute/v4/list_virtual_machines.rb +1 -0
  24. data/lib/fog/ovirt/requests/compute/v4/list_vm_interfaces.rb +1 -0
  25. data/lib/fog/ovirt/requests/compute/v4/list_vm_volumes.rb +7 -1
  26. data/lib/fog/ovirt/requests/compute/v4/list_vnic_profiles.rb +1 -0
  27. data/lib/fog/ovirt/requests/compute/v4/list_volumes.rb +1 -0
  28. data/lib/fog/ovirt/version.rb +1 -1
  29. metadata +8 -60
  30. data/.gitignore +0 -31
  31. data/.rubocop.yml +0 -33
  32. data/.rubocop_todo.yml +0 -62
  33. data/.travis.yml +0 -26
  34. data/CONTRIBUTING.md +0 -18
  35. data/Gemfile +0 -2
  36. data/fog-ovirt.gemspec +0 -34
  37. data/tests/helper.rb +0 -1
  38. data/tests/helpers/mock_helper.rb +0 -14
  39. data/tests/helpers/succeeds_helper.rb +0 -9
  40. data/tests/ovirt/compute_tests.rb +0 -24
  41. data/tests/ovirt/models/compute/cluster_tests.rb +0 -28
  42. data/tests/ovirt/models/compute/clusters_tests.rb +0 -7
  43. data/tests/ovirt/models/compute/instance_type_tests.rb +0 -23
  44. data/tests/ovirt/models/compute/instance_types_tests.rb +0 -7
  45. data/tests/ovirt/models/compute/interface_tests.rb +0 -25
  46. data/tests/ovirt/models/compute/interfaces_tests.rb +0 -7
  47. data/tests/ovirt/models/compute/operating_system_tests.rb +0 -23
  48. data/tests/ovirt/models/compute/operating_systems_tests.rb +0 -8
  49. data/tests/ovirt/models/compute/server_tests.rb +0 -48
  50. data/tests/ovirt/models/compute/servers_tests.rb +0 -12
  51. data/tests/ovirt/models/compute/template_tests.rb +0 -26
  52. data/tests/ovirt/models/compute/templates_tests.rb +0 -7
  53. data/tests/ovirt/requests/compute/v4/client_tests.rb +0 -31
  54. data/tests/ovirt/requests/compute/v4/create_vm_tests.rb +0 -18
  55. data/tests/ovirt/requests/compute/v4/destroy_vm_tests.rb +0 -14
  56. data/tests/ovirt/requests/compute/v4/list_datacenters_tests.rb +0 -11
  57. data/tests/ovirt/requests/compute/v4/list_quotas_tests.rb +0 -10
  58. data/tests/ovirt/requests/compute/v4/list_storage_domains_tests.rb +0 -11
  59. data/tests/ovirt/requests/compute/v4/update_volume_tests.rb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4823155b520813d343004cc89023ce9fd5aafc124e6cdce4a75ea04986977645
4
- data.tar.gz: dbcfa93d8371eef22b8f638fb765bd9bd5996370d4538b51722bc7226201d462
3
+ metadata.gz: ad1b764e5fc19f950f6c37bda08705d78f9dc1e4b808772539952887cddddb62
4
+ data.tar.gz: ee4a3ce2ab9e24c50f470a5b51ae91b8d551624605f74a7ee9326bfbeea63813
5
5
  SHA512:
6
- metadata.gz: 8aa5dd0e6bd07d9b8545689d00e8720cebcd1aa0867171b67539dbfb067e3c1a18711bc86fe5dcae2a8b66f9e38bd2dd2be8306577684f34c0d7516783bcf5a1
7
- data.tar.gz: f9db399c50da5e33b31aa92156f0d934804ba972512559000b3a6c59797e9e9955038d1ee9529ebe61b8cd50de768bc2be4292f037717e6144dcf7df246acbdd
6
+ metadata.gz: 11d3cc99c35abf7b61ee70ae6816e7ee6760dca389c5f908e0dbd8dec19707f798982bf3d5b823f2ab0edb0a4635c6dbfcc1bb16ca0eb5a4d0d567c361c87d35
7
+ data.tar.gz: 105dbc98bfdd19c4170dbf9053000da1516c17b233933964e30c19ed39896e27265c8000778dc594c57fb488e570c4d1447ca8a9bb9782e5b5b291741df1c1ab
@@ -1,5 +1,6 @@
1
1
  require "active_support"
2
2
  require "active_support/core_ext"
3
+ require "ostruct"
3
4
 
4
5
  module Fog
5
6
  module Ovirt
@@ -153,7 +154,7 @@ module Fog
153
154
  private
154
155
 
155
156
  def client
156
- return @client if defined?(@client)
157
+ @client if defined?(@client)
157
158
  end
158
159
 
159
160
  # read mocks xml
@@ -3,6 +3,7 @@ module Fog
3
3
  class Compute
4
4
  class Interface < Fog::Model
5
5
  attr_accessor :raw
6
+
6
7
  identity :id
7
8
 
8
9
  attribute :name
@@ -3,6 +3,7 @@ module Fog
3
3
  class Compute
4
4
  class OperatingSystem < Fog::Model
5
5
  attr_accessor :raw
6
+
6
7
  identity :id
7
8
 
8
9
  attribute :name
@@ -53,10 +53,14 @@ module Fog
53
53
  end
54
54
 
55
55
  def interfaces
56
- @interfaces ||= id.nil? ? [] : Fog::Ovirt::Compute::Interfaces.new(
57
- :service => service,
58
- :vm => self
59
- )
56
+ @interfaces ||= if id.nil?
57
+ []
58
+ else
59
+ Fog::Ovirt::Compute::Interfaces.new(
60
+ :service => service,
61
+ :vm => self
62
+ )
63
+ end
60
64
  end
61
65
 
62
66
  def add_interface(attrs)
@@ -75,10 +79,14 @@ module Fog
75
79
  end
76
80
 
77
81
  def volumes
78
- @volumes ||= id.nil? ? [] : Fog::Ovirt::Compute::Volumes.new(
79
- :service => service,
80
- :vm => self
81
- )
82
+ @volumes ||= if id.nil?
83
+ []
84
+ else
85
+ Fog::Ovirt::Compute::Volumes.new(
86
+ :service => service,
87
+ :vm => self
88
+ )
89
+ end
82
90
  end
83
91
 
84
92
  def add_volume(attrs)
@@ -126,7 +134,7 @@ module Fog
126
134
  user_data = if options[:use_custom_script]
127
135
  { :custom_script => options[:user_data] }
128
136
  else
129
- Hash[YAML.safe_load(options[:user_data]).map { |a| [a.first.to_sym, a.last] }]
137
+ YAML.safe_load(options[:user_data]).to_h { |a| [a.first.to_sym, a.last] }
130
138
  end
131
139
  action_status = service.vm_start_with_cloudinit(:id => id, :user_data => user_data)
132
140
  reload
@@ -160,7 +168,7 @@ module Fog
160
168
  (stop unless stopped?)
161
169
  rescue StandardError
162
170
  nil
163
- end # ignore failure, destroy the machine anyway.
171
+ end
164
172
  wait_for { stopped? }
165
173
  service.destroy_vm(:id => id)
166
174
  end
@@ -23,17 +23,25 @@ module Fog
23
23
  attribute :version
24
24
 
25
25
  def interfaces
26
- attributes[:interfaces] ||= id.nil? ? [] : Fog::Ovirt::Compute::Interfaces.new(
27
- :service => service,
28
- :vm => self
29
- )
26
+ attributes[:interfaces] ||= if id.nil?
27
+ []
28
+ else
29
+ Fog::Ovirt::Compute::Interfaces.new(
30
+ :service => service,
31
+ :vm => self
32
+ )
33
+ end
30
34
  end
31
35
 
32
36
  def volumes
33
- attributes[:volumes] ||= id.nil? ? [] : Fog::Ovirt::Compute::Volumes.new(
34
- :service => service,
35
- :vm => self
36
- )
37
+ attributes[:volumes] ||= if id.nil?
38
+ []
39
+ else
40
+ Fog::Ovirt::Compute::Volumes.new(
41
+ :service => service,
42
+ :vm => self
43
+ )
44
+ end
37
45
  end
38
46
 
39
47
  def ready?
@@ -3,6 +3,7 @@ module Fog
3
3
  class Compute
4
4
  class Volume < Fog::Model
5
5
  attr_accessor :raw
6
+
6
7
  identity :id
7
8
 
8
9
  attribute :storage_domain
@@ -7,6 +7,7 @@ module Fog
7
7
  "4.0"
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def api_version
12
13
  "4.0"
@@ -7,6 +7,7 @@ module Fog
7
7
  ovirt_attrs client.system_service.clusters_service.cluster_service(id).get
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def get_cluster(_id)
12
13
  xml = read_xml("cluster.xml")
@@ -7,6 +7,7 @@ module Fog
7
7
  ovirt_attrs client.system_service.instance_types_service.instance_type_service(id).get
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def get_instance_type(_id)
12
13
  xml = read_xml "instance_type.xml"
@@ -8,6 +8,7 @@ module Fog
8
8
  ovirt_attrs quota
9
9
  end
10
10
  end
11
+
11
12
  class Mock
12
13
  def get_quota(_id)
13
14
  xml = read_xml("quota.xml")
@@ -7,6 +7,7 @@ module Fog
7
7
  ovirt_attrs client.system_service.templates_service.template_service(id).get
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def get_template(_id)
12
13
  xml = read_xml "template.xml"
@@ -7,6 +7,7 @@ module Fog
7
7
  ovirt_attrs client.system_service.vms_service.vm_service(id).get(:all_content => true)
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def get_virtual_machine(_id)
12
13
  xml = read_xml "vm.xml"
@@ -7,6 +7,7 @@ module Fog
7
7
  ovirt_attrs client.system_service.disks_service.disk_service(id).get
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def get_volume(_id)
12
13
  xml = read_xml("disk.xml")
@@ -8,6 +8,7 @@ module Fog
8
8
  client.system_service.clusters_service.list(opts).map { |ovirt_obj| ovirt_attrs(ovirt_obj) }
9
9
  end
10
10
  end
11
+
11
12
  class Mock
12
13
  def list_clusters(_filters = {})
13
14
  xml = read_xml "clusters.xml"
@@ -7,6 +7,7 @@ module Fog
7
7
  client.system_service.instance_types_service.list(filters).map { |ovirt_obj| ovirt_attrs ovirt_obj }
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def list_instance_types(_filters = {})
12
13
  xml = read_xml "instance_types.xml"
@@ -7,6 +7,7 @@ module Fog
7
7
  client.system_service.clusters_service.cluster_service(cluster_id).networks_service.list
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def list_networks(_cluster_id)
12
13
  []
@@ -7,6 +7,7 @@ module Fog
7
7
  client.system_service.operating_systems_service.list.map { |ovirt_obj| ovirt_attrs ovirt_obj }
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def list_operating_systems
12
13
  xml = read_xml "operating_systems.xml"
@@ -8,6 +8,7 @@ module Fog
8
8
  data_center.quotas_service.list(filters).map { |ovirt_obj| ovirt_attrs ovirt_obj }
9
9
  end
10
10
  end
11
+
11
12
  class Mock
12
13
  def list_quotas(_filters = {})
13
14
  xml = read_xml "quotas.xml"
@@ -7,6 +7,7 @@ module Fog
7
7
  client.system_service.templates_service.template_service(vm_id).nics_service.list.map { |ovirt_obj| ovirt_attrs ovirt_obj }
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def list_template_interfaces(_vm_id)
12
13
  xml = read_xml "nics.xml"
@@ -18,6 +18,7 @@ module Fog
18
18
  end
19
19
  end
20
20
  end
21
+
21
22
  class Mock
22
23
  def list_template_volumes(_template_id)
23
24
  xml = read_xml "volumes.xml"
@@ -7,6 +7,7 @@ module Fog
7
7
  client.system_service.templates_service.list(filters).map { |ovirt_obj| ovirt_attrs ovirt_obj }
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def list_templates(_filters = {})
12
13
  xml = read_xml "templates.xml"
@@ -12,6 +12,7 @@ module Fog
12
12
  client.system_service.vms_service.list(filters).map { |ovirt_obj| ovirt_attrs ovirt_obj }
13
13
  end
14
14
  end
15
+
15
16
  class Mock
16
17
  def list_virtual_machines(_filters = {})
17
18
  xml = read_xml "vms.xml"
@@ -7,6 +7,7 @@ module Fog
7
7
  client.system_service.vms_service.vm_service(vm_id).nics_service.list.map { |ovirt_obj| ovirt_attrs ovirt_obj }
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def list_vm_interfaces(_vm_id)
12
13
  xml = read_xml "nics.xml"
@@ -13,11 +13,17 @@ module Fog
13
13
  interface = attachment.interface
14
14
  attachment_disk.bootable = bootable if attachment_disk.bootable.nil?
15
15
  attachment_disk.interface = interface if attachment_disk.interface.nil?
16
- attachment_disk.storage_domain = attachment_disk.storage_domains[0].id
16
+ attachment_disk.storage_domain = begin
17
+ attachment_disk.storage_domains.first&.id
18
+ rescue StandardError => e
19
+ Fog::Logger.warning("Error parsing attachment_disk.storage_domains - #{e}. Fallback to 0")
20
+ 0
21
+ end
17
22
  ovirt_attrs attachment_disk
18
23
  end
19
24
  end
20
25
  end
26
+
21
27
  class Mock
22
28
  def list_vm_volumes(_vm_id)
23
29
  xml = read_xml "volumes.xml"
@@ -13,6 +13,7 @@ module Fog
13
13
  dc_vnics
14
14
  end
15
15
  end
16
+
16
17
  class Mock
17
18
  def list_vnic_profiles(_filters = {})
18
19
  xml = read_xml "vnic_profiles.xml"
@@ -7,6 +7,7 @@ module Fog
7
7
  client.system_service.disks_service.list.map { |ovirt_obj| ovirt_attrs ovirt_obj }
8
8
  end
9
9
  end
10
+
10
11
  class Mock
11
12
  def list_volumes
12
13
  xml = read_xml "disks.xml"
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Ovirt
3
- VERSION = "2.0.2".freeze
3
+ VERSION = "2.0.3".freeze
4
4
  end
5
5
  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: 2.0.2
4
+ version: 2.0.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: 2022-06-07 00:00:00.000000000 Z
11
+ date: 2024-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0.52'
131
+ version: 1.65.1
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0.52'
138
+ version: 1.65.1
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: shindo
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -157,17 +157,10 @@ executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - ".gitignore"
161
- - ".rubocop.yml"
162
- - ".rubocop_todo.yml"
163
- - ".travis.yml"
164
- - CONTRIBUTING.md
165
160
  - CONTRIBUTORS.md
166
- - Gemfile
167
161
  - LICENSE.md
168
162
  - README.md
169
163
  - Rakefile
170
- - fog-ovirt.gemspec
171
164
  - lib/fog/bin/ovirt.rb
172
165
  - lib/fog/ovirt.rb
173
166
  - lib/fog/ovirt/compute.rb
@@ -248,33 +241,11 @@ files:
248
241
  - lib/fog/ovirt/version.rb
249
242
  - spec/fog/bin/ovirt_spec.rb
250
243
  - spec/fog/bin_spec.rb
251
- - tests/helper.rb
252
- - tests/helpers/mock_helper.rb
253
- - tests/helpers/succeeds_helper.rb
254
- - tests/ovirt/compute_tests.rb
255
- - tests/ovirt/models/compute/cluster_tests.rb
256
- - tests/ovirt/models/compute/clusters_tests.rb
257
- - tests/ovirt/models/compute/instance_type_tests.rb
258
- - tests/ovirt/models/compute/instance_types_tests.rb
259
- - tests/ovirt/models/compute/interface_tests.rb
260
- - tests/ovirt/models/compute/interfaces_tests.rb
261
- - tests/ovirt/models/compute/operating_system_tests.rb
262
- - tests/ovirt/models/compute/operating_systems_tests.rb
263
- - tests/ovirt/models/compute/server_tests.rb
264
- - tests/ovirt/models/compute/servers_tests.rb
265
- - tests/ovirt/models/compute/template_tests.rb
266
- - tests/ovirt/models/compute/templates_tests.rb
267
- - tests/ovirt/requests/compute/v4/client_tests.rb
268
- - tests/ovirt/requests/compute/v4/create_vm_tests.rb
269
- - tests/ovirt/requests/compute/v4/destroy_vm_tests.rb
270
- - tests/ovirt/requests/compute/v4/list_datacenters_tests.rb
271
- - tests/ovirt/requests/compute/v4/list_quotas_tests.rb
272
- - tests/ovirt/requests/compute/v4/list_storage_domains_tests.rb
273
- - tests/ovirt/requests/compute/v4/update_volume_tests.rb
274
244
  homepage: https://github.com/fog/fog-ovirt
275
245
  licenses:
276
246
  - MIT
277
- metadata: {}
247
+ metadata:
248
+ rubygems_mfa_required: 'true'
278
249
  post_install_message:
279
250
  rdoc_options: []
280
251
  require_paths:
@@ -290,31 +261,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
290
261
  - !ruby/object:Gem::Version
291
262
  version: '0'
292
263
  requirements: []
293
- rubygems_version: 3.1.6
264
+ rubygems_version: 3.5.18
294
265
  signing_key:
295
266
  specification_version: 4
296
267
  summary: Module for the 'fog' gem to support Ovirt.
297
- test_files:
298
- - tests/helper.rb
299
- - tests/helpers/mock_helper.rb
300
- - tests/helpers/succeeds_helper.rb
301
- - tests/ovirt/compute_tests.rb
302
- - tests/ovirt/models/compute/cluster_tests.rb
303
- - tests/ovirt/models/compute/clusters_tests.rb
304
- - tests/ovirt/models/compute/instance_type_tests.rb
305
- - tests/ovirt/models/compute/instance_types_tests.rb
306
- - tests/ovirt/models/compute/interface_tests.rb
307
- - tests/ovirt/models/compute/interfaces_tests.rb
308
- - tests/ovirt/models/compute/operating_system_tests.rb
309
- - tests/ovirt/models/compute/operating_systems_tests.rb
310
- - tests/ovirt/models/compute/server_tests.rb
311
- - tests/ovirt/models/compute/servers_tests.rb
312
- - tests/ovirt/models/compute/template_tests.rb
313
- - tests/ovirt/models/compute/templates_tests.rb
314
- - tests/ovirt/requests/compute/v4/client_tests.rb
315
- - tests/ovirt/requests/compute/v4/create_vm_tests.rb
316
- - tests/ovirt/requests/compute/v4/destroy_vm_tests.rb
317
- - tests/ovirt/requests/compute/v4/list_datacenters_tests.rb
318
- - tests/ovirt/requests/compute/v4/list_quotas_tests.rb
319
- - tests/ovirt/requests/compute/v4/list_storage_domains_tests.rb
320
- - tests/ovirt/requests/compute/v4/update_volume_tests.rb
268
+ test_files: []
data/.gitignore DELETED
@@ -1,31 +0,0 @@
1
- *~
2
- *.gem
3
- *.rbc
4
- *.sw?
5
- .rbenv
6
- .rvmrc
7
- .ruby-gemset
8
- .ruby-version
9
- .bundle
10
- .DS_Store
11
- .idea
12
- .yardoc
13
- /tests/.fog
14
- bin/*
15
- !bin/fog
16
- .fog
17
- coverage
18
- doc/*
19
- docs/_site/*
20
- docs/about/supported_services.markdown
21
- Gemfile.lock
22
- Gemfile.local.rb
23
- gemfiles/*.lock
24
- yardoc
25
- pkg
26
- spec/credentials.yml
27
- vendor/*
28
- tags
29
- tests/digitalocean/fixtures/
30
-
31
- providers/*/doc
data/.rubocop.yml DELETED
@@ -1,33 +0,0 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
- Style/HashSyntax:
4
- EnforcedStyle: hash_rockets
5
-
6
- Metrics/LineLength:
7
- Max: 100
8
- Enabled: false
9
-
10
- Style/StringLiterals:
11
- EnforcedStyle: double_quotes
12
-
13
- Style/Encoding:
14
- Description: 'Use UTF-8 as the source file encoding.'
15
- Enabled: false
16
-
17
- Style/SignalException:
18
- Description: 'Do not enforce use of fail when raising exceptions.'
19
- # Valid values are: semantic, only_raise and only_fail
20
- EnforcedStyle: only_raise
21
-
22
- Layout/EmptyLineAfterGuardClause:
23
- Enabled: false
24
-
25
- Metrics/AbcSize:
26
- Enabled: false
27
-
28
- Gemspec/RequiredRubyVersion:
29
- Enabled: false
30
-
31
- AllCops:
32
- Exclude:
33
- - 'lib/fog/ovirt/compute.rb'
data/.rubocop_todo.yml DELETED
@@ -1,62 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2020-10-15 17:29:26 +0300 using RuboCop version 0.81.0.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- # Configuration parameters: CountComments.
11
- Metrics/ClassLength:
12
- Max: 150
13
-
14
- # Offense count: 8
15
- # Configuration parameters: CountComments, ExcludedMethods.
16
- Metrics/MethodLength:
17
- Max: 26
18
-
19
- # Offense count: 1
20
- # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
21
- # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
22
- Naming/FileName:
23
- Exclude:
24
- - 'Gemfile.local.rb'
25
-
26
- # Offense count: 1
27
- Style/ClassVars:
28
- Exclude:
29
- - 'lib/fog/bin/ovirt.rb'
30
-
31
- # Offense count: 1
32
- Style/CommentedKeyword:
33
- Exclude:
34
- - 'lib/fog/ovirt/models/compute/server.rb'
35
-
36
- # Offense count: 98
37
- Style/Documentation:
38
- Enabled: false
39
-
40
- # Offense count: 3
41
- Style/DoubleNegation:
42
- Exclude:
43
- - 'lib/fog/ovirt/models/compute/server.rb'
44
- - 'tests/helpers/succeeds_helper.rb'
45
-
46
- # Offense count: 84
47
- # Cop supports --auto-correct.
48
- # Configuration parameters: EnforcedStyle.
49
- # SupportedStyles: always, always_true, never
50
- Style/FrozenStringLiteralComment:
51
- Enabled: false
52
-
53
- # Offense count: 3
54
- Style/MissingRespondToMissing:
55
- Exclude:
56
- - 'lib/fog/ovirt/compute.rb'
57
-
58
- # Offense count: 4
59
- Style/MultilineTernaryOperator:
60
- Exclude:
61
- - 'lib/fog/ovirt/models/compute/server.rb'
62
- - 'lib/fog/ovirt/models/compute/template.rb'
data/.travis.yml DELETED
@@ -1,26 +0,0 @@
1
- language: ruby
2
-
3
- sudo: false
4
- dist: trusty
5
-
6
- script:
7
- - bundle exec rake rubocop
8
- - bundle exec rake test
9
-
10
- rvm:
11
- - 2.1
12
- - 2.2
13
- - 2.3
14
- - 2.4
15
- - jruby-head
16
-
17
- gemfile:
18
- - Gemfile
19
-
20
- matrix:
21
- fast_finish: true
22
- allow_failures:
23
- - rvm: jruby-head
24
-
25
- notifications:
26
- email: false
data/CONTRIBUTING.md DELETED
@@ -1,18 +0,0 @@
1
- ## Getting Involved
2
-
3
- New contributors are always welcome, when it doubt please ask questions. We strive to be an open and welcoming community. Please be nice to one another.
4
-
5
- ### Coding
6
-
7
- * Pick a task:
8
- * Offer feedback on open [pull requests](https://github.com/fog/fog-ovirt/pulls).
9
- * Review open [issues](https://github.com/fog/fog-ovirt/issues) for things to help on.
10
- * [Create an issue](https://github.com/fog/fog-ovirt/issues/new) to start a discussion on additions or features.
11
- * Fork the project, add your changes and tests to cover them in a topic branch.
12
- * Commit your changes and rebase against `fog/fog-ovirt` to ensure everything is up to date.
13
- * [Submit a pull request](https://github.com/fog/fog-ovirt/compare/)
14
-
15
- ### Non-Coding
16
-
17
- * Offer feedback on open [issues](https://github.com/fog/fog-ovirt/issues).
18
- * Organize or volunteer at events.
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source "https://rubygems.org"
2
- gemspec
data/fog-ovirt.gemspec DELETED
@@ -1,34 +0,0 @@
1
- # coding: utf-8
2
-
3
- lib = File.expand_path("lib", __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
- require "fog/ovirt/version"
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "fog-ovirt"
9
- spec.version = Fog::Ovirt::VERSION
10
- spec.authors = ["Ori Rabin"]
11
- spec.email = ["orabin@redhat.com"]
12
-
13
- spec.summary = "Module for the 'fog' gem to support Ovirt."
14
- spec.description = "This library can be used as a module for `fog`."
15
- spec.homepage = "https://github.com/fog/fog-ovirt"
16
- spec.license = "MIT"
17
-
18
- spec.files = `git ls-files -z`.split("\x0")
19
- spec.test_files = spec.files.grep(%r{^tests\/})
20
- spec.require_paths = ["lib"]
21
- spec.required_ruby_version = ">= 2.0.0"
22
-
23
- spec.add_dependency("activesupport")
24
- spec.add_dependency("fog-core")
25
- spec.add_dependency("fog-json")
26
- spec.add_dependency("fog-xml")
27
- spec.add_dependency("ovirt-engine-sdk", ">= 4.3.1")
28
-
29
- spec.add_development_dependency "bundler"
30
- spec.add_development_dependency "pry"
31
- spec.add_development_dependency "rake"
32
- spec.add_development_dependency "rubocop", "~> 0.52"
33
- spec.add_development_dependency "shindo"
34
- end
data/tests/helper.rb DELETED
@@ -1 +0,0 @@
1
- require File.expand_path("../lib/fog/ovirt", __dir__)
@@ -1,14 +0,0 @@
1
- # Use so you can run in mock mode from the command line
2
- #
3
- # FOG_MOCK=true fog
4
-
5
- Fog.mock! if ENV["FOG_MOCK"] == "true"
6
-
7
- # if in mocked mode, fill in some fake credentials for us
8
- if Fog.mock?
9
- Fog.credentials = {
10
- :ovirt_url => "http://ovirt:8080/api",
11
- :ovirt_username => "admin@internal",
12
- :ovirt_password => "123123"
13
- }.merge(Fog.credentials)
14
- end
@@ -1,9 +0,0 @@
1
- module Shindo
2
- class Tests
3
- def succeeds
4
- test("succeeds") do
5
- !!instance_eval(&Proc.new)
6
- end
7
- end
8
- end
9
- end
@@ -1,24 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new", ["ovirt"]) do
2
- compute = Fog::Ovirt::Compute.new
3
-
4
- tests("Compute attributes") do
5
- %w[ovirt_attrs].each do |attr|
6
- test("it should respond to #{attr}") { compute.respond_to? attr }
7
- end
8
- end
9
-
10
- tests("Compute collections") do
11
- %w[servers templates clusters interfaces operating_systems].each do |collection|
12
- test("it should respond to #{collection}") { compute.respond_to? collection }
13
- end
14
- end
15
-
16
- tests("Compute requests") do
17
- %w[ add_interface create_vm datacenters destroy_interface destroy_vm get_cluster get_template
18
- get_virtual_machine list_clusters list_networks list_template_interfaces list_templates
19
- list_virtual_machines list_vm_interfaces storage_domains update_interface update_vm vm_action
20
- vm_start_with_cloudinit api_version update_volume].each do |collection|
21
- test("it should respond to #{collection}") { compute.respond_to? collection }
22
- end
23
- end
24
- end
@@ -1,28 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | cluster model", ["ovirt"]) do
2
- clusters = Fog::Ovirt::Compute.new.clusters
3
- cluster = clusters.last
4
-
5
- tests("The cluster model should") do
6
- tests("have the action") do
7
- test("reload") { cluster.respond_to? "reload" }
8
- %w[networks].each do |action|
9
- test(action) { cluster.respond_to? action }
10
- end
11
- end
12
- tests("have attributes") do
13
- model_attribute_hash = cluster.attributes
14
- attributes = %i[id name]
15
- tests("The cluster model should respond to") do
16
- attributes.each do |attribute|
17
- test(attribute.to_s) { cluster.respond_to? attribute }
18
- end
19
- end
20
- tests("The attributes hash should have key") do
21
- attributes.each do |attribute|
22
- test(attribute.to_s) { model_attribute_hash.key? attribute }
23
- end
24
- end
25
- end
26
- test("be a kind of Fog::Ovirt::Compute::Cluster") { cluster.is_a? Fog::Ovirt::Compute::Cluster }
27
- end
28
- end
@@ -1,7 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | clusters collection", ["ovirt"]) do
2
- clusters = Fog::Ovirt::Compute.new.clusters
3
-
4
- tests("The clusters collection") do
5
- test("should be a kind of Fog::Ovirt::Compute::Clusters") { clusters.is_a? Fog::Ovirt::Compute::Clusters }
6
- end
7
- end
@@ -1,23 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | instance_type model", ["ovirt"]) do
2
- instance_types = Fog::Ovirt::Compute.new.instance_types
3
- instance_type = instance_types.last
4
-
5
- tests("The instance_type model should") do
6
- tests("have attributes") do
7
- model_attribute_hash = instance_type.attributes
8
- attributes = %i[id name memory sockets cores]
9
-
10
- tests("The instance type model should respond to") do
11
- attributes.each do |attribute|
12
- test(attribute.to_s) { instance_type.respond_to? attribute }
13
- end
14
- end
15
- tests("The attributes hash should have key") do
16
- attributes.each do |attribute|
17
- test(attribute.to_s) { model_attribute_hash.key? attribute }
18
- end
19
- end
20
- end
21
- test("be a kind of Fog::Ovirt::Compute::InstanceType") { instance_type.is_a? Fog::Ovirt::Compute::InstanceType }
22
- end
23
- end
@@ -1,7 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | instance types collection", ["ovirt"]) do
2
- instance_types = Fog::Ovirt::Compute.new.instance_types
3
-
4
- tests("The instance types collection") do
5
- test("should be a kind of Fog::Ovirt::Compute::InstanceTypes") { instance_types.is_a? Fog::Ovirt::Compute::InstanceTypes }
6
- end
7
- end
@@ -1,25 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | interface model", ["ovirt"]) do
2
- interfaces = Fog::Ovirt::Compute.new.servers.last.interfaces
3
- interface = interfaces.last
4
-
5
- tests("The interface model should") do
6
- tests("have the action") do
7
- test("reload") { interface.respond_to? "reload" }
8
- end
9
- tests("have attributes") do
10
- model_attribute_hash = interface.attributes
11
- attributes = %i[id name network]
12
- tests("The interface model should respond to") do
13
- attributes.each do |attribute|
14
- test(attribute.to_s) { interface.respond_to? attribute }
15
- end
16
- end
17
- tests("The attributes hash should have key") do
18
- attributes.each do |attribute|
19
- test(attribute.to_s) { model_attribute_hash.key? attribute }
20
- end
21
- end
22
- end
23
- test("be a kind of Fog::Ovirt::Compute::Interface") { interface.is_a? Fog::Ovirt::Compute::Interface }
24
- end
25
- end
@@ -1,7 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | interfaces collection", ["ovirt"]) do
2
- interfaces = Fog::Ovirt::Compute.new.interfaces
3
-
4
- tests("The interfaces collection") do
5
- test("should be a kind of Fog::Ovirt::Compute::Interfaces") { interfaces.is_a? Fog::Ovirt::Compute::Interfaces }
6
- end
7
- end
@@ -1,23 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | operating_system model", ["ovirt"]) do
2
- operating_systems = Fog::Ovirt::Compute.new.operating_systems
3
- operating_system = operating_systems.last
4
-
5
- tests("The operating_system model should") do
6
- tests("have attributes") do
7
- model_attribute_hash = operating_system.attributes
8
- attributes = %i[id name href description]
9
-
10
- tests("The operating_system model should respond to") do
11
- attributes.each do |attribute|
12
- test(attribute.to_s) { operating_system.respond_to? attribute }
13
- end
14
- end
15
- tests("The attributes hash should have key") do
16
- attributes.each do |attribute|
17
- test(attribute.to_s) { model_attribute_hash.key? attribute }
18
- end
19
- end
20
- end
21
- test("be a kind of Fog::Ovirt::Compute::OperatingSystem") { operating_system.is_a? Fog::Ovirt::Compute::OperatingSystem }
22
- end
23
- end
@@ -1,8 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | operating_systems collection", ["ovirt"]) do
2
- operating_systems = Fog::Ovirt::Compute.new.operating_systems
3
-
4
- tests("The servers collection") do
5
- test("should not be empty") { !operating_systems.empty? }
6
- test("should be a kind of Fog::Ovirt::Compute::OperatingSystems") { operating_systems.is_a? Fog::Ovirt::Compute::OperatingSystems }
7
- end
8
- end
@@ -1,48 +0,0 @@
1
- # rubocop:disable Metrics/BlockLength
2
- Shindo.tests("Fog::Ovirt::Compute.new | server model", ["ovirt"]) do
3
- servers = Fog::Ovirt::Compute.new.servers
4
- server = servers.last
5
-
6
- tests("The server model should") do
7
- tests("have the action") do
8
- test("reload") { server.respond_to? "reload" }
9
- %w[start stop destroy reboot suspend].each do |action|
10
- test(action) { server.respond_to? action }
11
- end
12
- %w[start reboot suspend stop].each do |action|
13
- test("#{action} returns successfully") do
14
- server.send(action.to_sym) ? true : false
15
- end
16
- end
17
- end
18
- tests("have attributes") do
19
- model_attribute_hash = server.attributes
20
- attributes = %i[
21
- id
22
- name
23
- description
24
- profile
25
- display
26
- creation_time
27
- os
28
- status
29
- cores
30
- memory
31
- cluster
32
- template
33
- ]
34
- tests("The server model should respond to") do
35
- attributes.each do |attribute|
36
- test(attribute.to_s) { server.respond_to? attribute }
37
- end
38
- end
39
- tests("The attributes hash should have key") do
40
- attributes.each do |attribute|
41
- test(attribute.to_s) { model_attribute_hash.key? attribute }
42
- end
43
- end
44
- end
45
- test("be a kind of Fog::Ovirt::Compute::Server") { server.is_a? Fog::Ovirt::Compute::Server }
46
- end
47
- end
48
- # rubocop:enable Metrics/BlockLength
@@ -1,12 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | servers collection", ["ovirt"]) do
2
- servers = Fog::Ovirt::Compute.new.servers
3
-
4
- tests("The servers collection") do
5
- test("should not be empty") { !servers.empty? }
6
- test("should be a kind of Fog::Ovirt::Compute::Servers") { servers.is_a? Fog::Ovirt::Compute::Servers }
7
- tests("should be able to reload itself").succeeds { servers.reload }
8
- tests("should be able to get a model") do
9
- tests("by instance uuid").succeeds { servers.get servers.first.id }
10
- end
11
- end
12
- end
@@ -1,26 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | template model", ["ovirt"]) do
2
- templates = Fog::Ovirt::Compute.new.templates
3
- template = templates.last
4
-
5
- tests("The template model should") do
6
- tests("have the action") do
7
- test("reload") { template.respond_to? "reload" }
8
- end
9
- tests("have attributes") do
10
- model_attribute_hash = template.attributes
11
- attributes = %i[id name]
12
-
13
- tests("The template model should respond to") do
14
- attributes.each do |attribute|
15
- test(attribute.to_s) { template.respond_to? attribute }
16
- end
17
- end
18
- tests("The attributes hash should have key") do
19
- attributes.each do |attribute|
20
- test(attribute.to_s) { model_attribute_hash.key? attribute }
21
- end
22
- end
23
- end
24
- test("be a kind of Fog::Ovirt::Compute::Template") { template.is_a? Fog::Ovirt::Compute::Template }
25
- end
26
- end
@@ -1,7 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | templates collection", ["ovirt"]) do
2
- templates = Fog::Ovirt::Compute.new.templates
3
-
4
- tests("The templates collection") do
5
- test("should be a kind of Fog::Ovirt::Compute::Templates") { templates.is_a? Fog::Ovirt::Compute::Templates }
6
- end
7
- end
@@ -1,31 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new | client", ["ovirt"]) do
2
- before do
3
- @client_mock = Object.new
4
- def @client_mock.foo
5
- raise ::Fog::Ovirt::Errors::OvirtError, "Test"
6
- end
7
-
8
- @object_under_test = Fog::Ovirt::Compute::ExceptionWrapper.new(@client_mock)
9
- end
10
-
11
- tests("Raises the right type of exception")
12
- .raises(Fog::Ovirt::Errors::OvirtEngineError) do
13
- @object_under_test.foo
14
- end
15
-
16
- tests("The exception test is as expected").returns(true) do
17
- begin
18
- @object_under_test.foo
19
- rescue Fog::Ovirt::Errors::OvirtEngineError => e
20
- e.message == "Ovirt client returned an error: Test"
21
- end
22
- end
23
-
24
- tests("The original exception test is as expected").returns(true) do
25
- begin
26
- @object_under_test.foo
27
- rescue Fog::Ovirt::Errors::OvirtEngineError => e
28
- e.orig_exception.message == "Test"
29
- end
30
- end
31
- end
@@ -1,18 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute v4 | vm_create request", "ovirt") do
2
- compute = Fog::Ovirt::Compute.new(:api_version => "v4")
3
- name_base = Time.now.to_i
4
-
5
- tests("Create VM") do
6
- response = compute.create_vm(:name => "fog-" + name_base.to_s, :cluster_name => "Default")
7
- test("should be a kind of OvirtSDK4::Vm") { response.is_a? OvirtSDK4::Vm }
8
- test("should be a 'OvirtSDK4::VmType::SERVER' VM type by default") { response.type == OvirtSDK4::VmType::SERVER }
9
- end
10
-
11
- tests("Create VM from template (clone)") do
12
- response = compute.create_vm(:name => "fog-" + (name_base + 1).to_s, :template_name => "hwp_small", :cluster_name => "Default")
13
- test("should be a kind of OvirtSDK4::Vm") { response.is_a? OvirtSDK4::Vm }
14
- end
15
-
16
- # TODO: Write a test for situation where creating a VM fails
17
- # mocks never raise exceptions
18
- end
@@ -1,14 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute v4 | vm_destroy request", ["ovirt"]) do
2
- compute = Fog::Ovirt::Compute.new(:api_version => "v4")
3
- compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default") if compute.servers.all(:search => "fog-*").empty?
4
- vm_id = compute.servers.all(:search => "fog-*").last.id
5
-
6
- tests("The response should") do
7
- response = compute.destroy_vm(:id => vm_id)
8
- test("be a success") { response ? true : false }
9
- end
10
-
11
- tests("The expected options") do
12
- raises(ArgumentError, "raises ArgumentError when id option is missing") { compute.destroy_vm }
13
- end
14
- end
@@ -1,11 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new v4 | datacenters request", ["ovirt"]) do
2
- compute = Fog::Compute.new(:provider => :ovirt, :api_version => "v4")
3
-
4
- tests("When listing all datacenters") do
5
- response = compute.datacenters
6
- tests("The response data format ...") do
7
- test("it should be a kind of Array") { response.is_a? Array }
8
- test("be a kind of Hash") { response.first.is_a? Hash }
9
- end
10
- end
11
- end
@@ -1,10 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new v4 | quotas request", ["ovirt"]) do
2
- compute = Fog::Compute.new(:provider => :ovirt, :api_version => "v4")
3
-
4
- tests("When listing all quotas") do
5
- response = compute.quotas
6
- tests("The response data format ...") do
7
- test("it should be a kind of Array") { response.is_a? Array }
8
- end
9
- end
10
- end
@@ -1,11 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new v4 | storage_domains request", ["ovirt"]) do
2
- compute = Fog::Compute.new(:provider => :ovirt, :api_version => "v4")
3
-
4
- tests("When listing all storage_domains") do
5
- response = compute.storage_domains
6
- tests("The response data format ...") do
7
- test("it should be a kind of Array") { response.is_a? Array }
8
- test("be a kind of OvirtSDK4::StorageDomain") { response.first.is_a? OvirtSDK4::StorageDomain }
9
- end
10
- end
11
- end
@@ -1,15 +0,0 @@
1
- Shindo.tests("Fog::Ovirt::Compute.new v4 | update_volume request", ["ovirt"]) do
2
- compute = Fog::Compute.new(:provider => :ovirt, :api_version => "v4")
3
- compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default") if compute.servers.all(:search => "fog-*").empty?
4
- vm_id = compute.servers.all(:search => "fog-*").last
5
-
6
- tests("The expected options") do
7
- raises(ArgumentError, "raises ArgumentError when vm id is missing") { compute.update_volume(nil, :id => 1) }
8
- raises(ArgumentError, "raises ArgumentError when disk_id option is missing") { compute.update_volume(1, :any => 1) }
9
- end
10
-
11
- tests("The response should") do
12
- response = compute.update_volume(vm_id, :id => 1)
13
- test("be a success") { response ? true : false }
14
- end
15
- end