fog-ovirt 1.1.2 → 1.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: 88ead8cc94b6a7acb2e54a922633619a62e86d54
4
- data.tar.gz: 2ced4f951fa5a6950bdf854bbae056437410e26f
3
+ metadata.gz: 2e47fa7e306962a88299505ea5723bf4374c3f1c
4
+ data.tar.gz: 9cc07868f6ed1a2f8dd5a96f93c62d4b4b8650df
5
5
  SHA512:
6
- metadata.gz: f8ab39302130b3697d45fc13dfd8693f2b58e00b28d15386654e8e7551633bb8c644bb7fe5c525bb6059620b1b9ecb4ea43c2c9b4681210e1aaaf1b9caefbd59
7
- data.tar.gz: c2fe9a22bd7f3821cb226d3afa92eb39c5cdf1ead6d5886d0a49a46745b18eb0e18776d05c015100419995c0b56ff7d14aefc529b4cb08acfb9c3c7d6b1941c3
6
+ metadata.gz: 3aa5058b8381d5859cb654a192c30e1067722f435f9acbca22dce5763b42518ab6d0ac30f4f1def9f6ac768a7a0d384f6551618da679e7d7e462d99cdacf71ca
7
+ data.tar.gz: 296fe2cff9e9e6fa0e9b0e93e86ecc2bdb32897152a2acd7ba5a5947bde8d8504fee2861e3414d91d4a4561bf2ffc5a91131e08d3c643a29aff4aab0068f12b6
data/.rubocop.yml CHANGED
@@ -18,3 +18,6 @@ Style/SignalException:
18
18
  Description: 'Do not enforce use of fail when raising exceptions.'
19
19
  # Valid values are: semantic, only_raise and only_fail
20
20
  EnforcedStyle: only_raise
21
+
22
+ Layout/EmptyLineAfterGuardClause:
23
+ Enabled: false
@@ -63,9 +63,7 @@ module Fog
63
63
  # ignore nil values
64
64
  next if value.nil?
65
65
 
66
- if key != :data_center && value.respond_to?(:href) && value.href && value.respond_to?(:id)
67
- opts[key] = value.id
68
- end
66
+ opts[key] = value.id if key != :data_center && value.respond_to?(:href) && value.href && value.respond_to?(:id)
69
67
 
70
68
  opts[key] ||= get_attr_value(value, opts)
71
69
  end
@@ -78,10 +76,11 @@ module Fog
78
76
  case value
79
77
  when OvirtSDK4::List
80
78
  value.to_a
81
- when Array, Hash, DateTime
79
+ when Array, Hash, DateTime, TrueClass, FalseClass
82
80
  value
83
81
  when OvirtSDK4::HighAvailability
84
82
  opts[:ha] = value.enabled
83
+ value
85
84
  when OvirtSDK4::TemplateVersion
86
85
  OpenStruct.new(:version_name => value.version_name, :version_number => value.version_number)
87
86
  when OvirtSDK4::Mac
@@ -144,7 +143,7 @@ module Fog
144
143
  url = options[:ovirt_url] || "https://#{server}:#{port}#{api_path}"
145
144
 
146
145
  connection_opts = {
147
- :url => url,
146
+ :url => url,
148
147
  :username => username,
149
148
  :password => password
150
149
  }
@@ -26,6 +26,7 @@ module Fog
26
26
  options[:provisioned_size] ||= 8 * Fog::Compute::Ovirt::DISK_SIZE_TO_GB
27
27
  options[:type] ||= OvirtSDK4::DiskType::DATA
28
28
  options[:format] ||= OvirtSDK4::DiskFormat::COW
29
+
29
30
  options[:sparse] = true unless options[:sparse].present?
30
31
  options[:quota] = options[:quota].present? ? client.system_service.data_centers_service.data_center_service(datacenter).quotas_service.quota_service(options[:quota]).get : nil
31
32
 
@@ -33,8 +34,8 @@ module Fog
33
34
  options[:disk][:storage_domains] ||= [client.system_service.storage_domains_service.storage_domain_service(options[:storage_domain_id]).get]
34
35
  options[:disk][:provisioned_size] ||= options.delete(:provisioned_size)
35
36
  options[:disk][:format] ||= options.delete(:format)
36
- options[:disk][:sparse] ||= options.delete(:sparse) == "true"
37
- options[:disk][:wipe_after_delete] ||= options.delete(:wipe_after_delete) == "true"
37
+ options[:disk][:sparse] ||= options.delete(:sparse)
38
+ options[:disk][:wipe_after_delete] ||= options.delete(:wipe_after_delete)
38
39
  options
39
40
  end
40
41
  # rubocop:enable Metrics/AbcSize
@@ -3,15 +3,22 @@ module Fog
3
3
  class Ovirt
4
4
  class V4
5
5
  class Real
6
+ # rubocop:disable Metrics/AbcSize
6
7
  def list_template_volumes(template_id)
7
8
  template = client.system_service.templates_service.template_service(template_id).get
8
-
9
9
  attachments = client.follow_link(template.disk_attachments)
10
-
11
10
  attachments.map do |attachment|
12
- ovirt_attrs client.follow_link(attachment.disk)
11
+ attachment_disk = client.follow_link(attachment.disk)
12
+ attachment = client.follow_link(attachment)
13
+ bootable = attachment.bootable
14
+ interface = attachment.interface
15
+ attachment_disk.bootable = bootable if attachment_disk.bootable.nil?
16
+ attachment_disk.interface = interface if attachment_disk.interface.nil?
17
+ attachment_disk.storage_domain = attachment_disk.storage_domains[0].id if attachment_disk.storage_domains[0].present?
18
+ ovirt_attrs attachment_disk
13
19
  end
14
20
  end
21
+ # rubocop:enable Metrics/AbcSize
15
22
  end
16
23
  class Mock
17
24
  def list_template_volumes(_template_id)
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Ovirt
3
- VERSION = "1.1.2".freeze
3
+ VERSION = "1.1.3".freeze
4
4
  end
5
5
  end
@@ -8,7 +8,7 @@ Fog.mock! if ENV["FOG_MOCK"] == "true"
8
8
  if Fog.mock?
9
9
  Fog.credentials = {
10
10
  :ovirt_url => "http://ovirt:8080/api",
11
- :ovirt_username => "admin@internal",
12
- :ovirt_password => "123123"
11
+ :ovirt_username => "admin@internal",
12
+ :ovirt_password => "123123"
13
13
  }.merge(Fog.credentials)
14
14
  end
@@ -1,8 +1,6 @@
1
1
  Shindo.tests("Fog::Compute[:ovirt] | vm_destroy request", ["ovirt"]) do
2
2
  compute = Fog::Compute[:ovirt]
3
- if compute.servers.all(:search => "fog-*").empty?
4
- compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default")
5
- end
3
+ compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default") if compute.servers.all(:search => "fog-*").empty?
6
4
  vm_id = compute.servers.all(:search => "fog-*").last.id
7
5
 
8
6
  tests("The response should") do
@@ -1,8 +1,6 @@
1
1
  Shindo.tests("Fog::Compute[:ovirt] | vm_update request", ["ovirt"]) do
2
2
  compute = Fog::Compute[:ovirt]
3
- if compute.servers.all(:search => "fog-*").empty?
4
- compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default")
5
- end
3
+ compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default") if compute.servers.all(:search => "fog-*").empty?
6
4
  vm = compute.servers.all(:search => "fog-*").last
7
5
 
8
6
  tests("The response should") do
@@ -1,8 +1,6 @@
1
1
  Shindo.tests("Fog::Compute[:ovirt] | update_volume request", ["ovirt"]) do
2
2
  compute = Fog::Compute[:ovirt]
3
- if compute.servers.all(:search => "fog-*").empty?
4
- compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default")
5
- end
3
+ compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default") if compute.servers.all(:search => "fog-*").empty?
6
4
  vm_id = compute.servers.all(:search => "fog-*").last
7
5
 
8
6
  tests("The expected options") do
@@ -1,8 +1,6 @@
1
1
  Shindo.tests("Fog::Compute[:ovirt] v4 | vm_destroy request", ["ovirt"]) do
2
2
  compute = Fog::Compute.new(:provider => :ovirt, :api_version => "v4")
3
- if compute.servers.all(:search => "fog-*").empty?
4
- compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default")
5
- end
3
+ compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default") if compute.servers.all(:search => "fog-*").empty?
6
4
  vm_id = compute.servers.all(:search => "fog-*").last.id
7
5
 
8
6
  tests("The response should") do
@@ -1,8 +1,6 @@
1
1
  Shindo.tests("Fog::Compute[:ovirt] v4 | update_volume request", ["ovirt"]) do
2
2
  compute = Fog::Compute.new(:provider => :ovirt, :api_version => "v4")
3
- if compute.servers.all(:search => "fog-*").empty?
4
- compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default")
5
- end
3
+ compute.create_vm(:name => "fog-" + Time.now.to_i.to_s, :cluster_name => "Default") if compute.servers.all(:search => "fog-*").empty?
6
4
  vm_id = compute.servers.all(:search => "fog-*").last
7
5
 
8
6
  tests("The expected options") do
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.1.2
4
+ version: 1.1.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: 2018-08-30 00:00:00.000000000 Z
11
+ date: 2018-12-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fog-core