foreman_kubevirt 0.5.2 → 0.5.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf485c758f474f165b3f447b543f6f125ae5a507a06c611baed7fc9c20c9db86
4
- data.tar.gz: e16eca90c17c3f4f25d1686195f19609951002eac567174e826b32ad9650f76e
3
+ metadata.gz: 27a32cc9e111db27e1c4e447aeb8fe1c7d556a542999008f54d8593032fa7231
4
+ data.tar.gz: 411a38571296341bcd8cd0d79286d4caa3f15a35f359723ad7b80b3ebd522949
5
5
  SHA512:
6
- metadata.gz: a9ece666c6b3af21d27a29709904f21c27cf78b234441b7e0494ca11026873e2d333974dfdd16892217ea6e6e8b7f6fa4280cbbc43e26c6927a080741d037ee0
7
- data.tar.gz: 1ca9cfa2aa37f9d068f3231ea2e0f4361447f3edef30a76b50bc844500abe4080307970fa5d71c175b7d90aeb6f928b0b4030ae1d66ab7c0a9cd37c8f2bdb8a2
6
+ metadata.gz: afbf6ececc85edf062ccd38a1061b885b46c6cc4c5f1810883a12769d7e054825c0461dcfdabe16025624b567385ae48f2183b2791d23ae6901f462cae6952f9
7
+ data.tar.gz: a9965b82dcef601bc0f941ded45a2a9f8a359826d2328668a094f12951a9c92bc81263b4f4e5f0380f11f6cbf9cc12e4b879e5e7363b203ae1616ba7157499c4
@@ -14,7 +14,7 @@ module FogExtensions
14
14
  return fog_memory if fog_memory.is_a?(Numeric)
15
15
  return nil if fog_memory.blank?
16
16
 
17
- ::Fog::Kubevirt::Utils::UnitConverter.convert(fog_memory, :b).to_i
17
+ ::Fog::Kubevirt::Utils::UnitConverter.convert("#{fog_memory}b", :b)
18
18
  rescue StandardError => e
19
19
  Rails.logger.warn("Failed to convert memory '#{fog_memory}': #{e.message}")
20
20
  nil
@@ -35,6 +35,10 @@ module FogExtensions
35
35
  def volumes_attributes=(attrs)
36
36
  end
37
37
 
38
+ def id
39
+ name
40
+ end
41
+
38
42
  def uuid
39
43
  name
40
44
  end
@@ -280,10 +280,10 @@ module ForemanKubevirt
280
280
 
281
281
  def new_vm(attr = {})
282
282
  vm = super
283
- interfaces = nested_attributes_for :interfaces, attr[:interfaces_attributes]
284
- interfaces.map { |i| vm.interfaces << new_interface(i) }
285
- volumes = nested_attributes_for :volumes, attr[:volumes_attributes]
286
- volumes.map { |v| vm.volumes << new_volume(v) }
283
+ iface_nested_attrs = nested_attributes_for :interfaces, attr[:interfaces_attributes]
284
+ vm.interfaces = iface_nested_attrs.map { |i| new_interface(i) }
285
+ volume_nested_attrs = nested_attributes_for :volumes, attr[:volumes_attributes]
286
+ vm.volumes = volume_nested_attrs.map { |v| new_volume(v) }
287
287
  vm
288
288
  end
289
289
 
@@ -1,3 +1,3 @@
1
1
  module ForemanKubevirt
2
- VERSION = '0.5.2'.freeze
2
+ VERSION = '0.5.3'.freeze
3
3
  end
@@ -57,6 +57,8 @@ class ForemanKubevirtTest < ActiveSupport::TestCase
57
57
 
58
58
  test "raises an error for image based provisioning without an explicit boot volume" do
59
59
  record = new_kubevirt_vcr
60
+ client = mocked_client
61
+ record.stubs(:client).returns(client)
60
62
 
61
63
  error = assert_raises(Foreman::Exception) do
62
64
  record.create_vm({ :name => "test", :provision_method => 'image', :image_id => "default/template", :volumes_attributes => {}, :interfaces_attributes => { "0" => { "cni_provider" => "multus", "network" => "default/network" } } })
@@ -93,6 +95,8 @@ class ForemanKubevirtTest < ActiveSupport::TestCase
93
95
 
94
96
  test "raises an error for image based provisioning with only an extra data volume" do
95
97
  record = new_kubevirt_vcr
98
+ client = mocked_client
99
+ record.stubs(:client).returns(client)
96
100
 
97
101
  error = assert_raises(Foreman::Exception) do
98
102
  record.create_vm({ :name => "test", :provision_method => 'image', :image_id => "default/template", :volumes_attributes => { "0" => { :capacity => "10" } }, :interfaces_attributes => { "0" => { "cni_provider" => "multus", "network" => "default/network" } } })
@@ -161,6 +161,6 @@ class ForemanKubevirtTest < ActiveSupport::TestCase
161
161
  server = compute_resource.create_vm(vm_args)
162
162
 
163
163
  # verify default memory value is set
164
- assert_equal "1024M", server.memory
164
+ assert_equal 1_024_000_000, server.memory
165
165
  end
166
166
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_kubevirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moti Asayag