foreman_fog_proxmox 0.10.1 → 0.12.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of foreman_fog_proxmox might be problematic. Click here for more details.

Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +62 -13
  3. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +7 -7
  4. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_server.js +0 -22
  5. data/app/helpers/proxmox_compute_selectors_helper.rb +14 -0
  6. data/app/helpers/proxmox_server_helper.rb +2 -6
  7. data/app/helpers/proxmox_vm_helper.rb +2 -10
  8. data/app/models/concerns/fog_extensions/proxmox/server.rb +1 -0
  9. data/app/models/foreman_fog_proxmox/proxmox_compute_attributes.rb +14 -1
  10. data/app/models/foreman_fog_proxmox/proxmox_connection.rb +1 -1
  11. data/app/models/foreman_fog_proxmox/proxmox_operating_systems.rb +1 -1
  12. data/app/models/foreman_fog_proxmox/proxmox_pools.rb +56 -0
  13. data/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb +5 -1
  14. data/app/models/foreman_fog_proxmox/proxmox_vm_new.rb +4 -4
  15. data/app/models/foreman_fog_proxmox/proxmox_vm_queries.rb +6 -7
  16. data/app/views/api/v2/compute_resources/proxmox.json.rabl +1 -1
  17. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_nic_provider_specific_form.html.erb +2 -2
  18. data/app/views/compute_resources_vms/form/proxmox/_general.html.erb +1 -0
  19. data/app/views/compute_resources_vms/form/proxmox/server/_config.html.erb +4 -4
  20. data/app/views/compute_resources_vms/show/_proxmox.html.erb +1 -0
  21. data/lib/foreman_fog_proxmox/engine.rb +2 -2
  22. data/lib/foreman_fog_proxmox/version.rb +1 -1
  23. data/locale/en/foreman_fog_proxmox.po +18 -3
  24. data/locale/foreman_fog_proxmox.pot +48 -28
  25. data/locale/fr/foreman_fog_proxmox.po +18 -3
  26. data/test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb +6 -0
  27. data/test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb +4 -4
  28. data/test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb +10 -9
  29. data/test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb +1 -1
  30. data/test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb +10 -2
  31. data/test/unit/foreman_fog_proxmox/proxmox_version_test.rb +4 -4
  32. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb +14 -0
  33. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb +29 -1
  34. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb +91 -0
  35. data/test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb +7 -2
  36. data/test/unit/foreman_fog_proxmox/semver_test.rb +3 -5
  37. metadata +21 -24
  38. data/locale/en/foreman_fog_proxmox.edit.po +0 -508
  39. data/locale/en/foreman_fog_proxmox.po.time_stamp +0 -0
  40. data/locale/fr/foreman_fog_proxmox.edit.po +0 -508
  41. data/locale/fr/foreman_fog_proxmox.po.time_stamp +0 -0
@@ -187,17 +187,17 @@ module ForemanFogProxmox
187
187
  deletes = []
188
188
  nics = []
189
189
  add_container_interface(host_delete['interfaces_attributes']['0'], deletes, nics)
190
- assert nics.empty?
190
+ assert_empty nics
191
191
  assert_equal 1, deletes.length
192
192
  assert_equal 'net0', deletes[0]
193
193
  end
194
194
 
195
195
  test '#interfaces' do
196
196
  interfaces_to_add, interfaces_to_delete = parse_container_interfaces(host['interfaces_attributes'])
197
- assert interfaces_to_delete.empty?
197
+ assert_empty interfaces_to_delete
198
198
  assert_equal 2, interfaces_to_add.length
199
- assert interfaces_to_add.include?(net0: 'name=eth0,bridge=vmbr0,ip=dhcp,ip6=dhcp,gw=192.168.56.100,gw6=2001:0:1234::c1c0:abcd:876')
200
- assert interfaces_to_add.include?(net1: 'name=eth1,bridge=vmbr0,ip=dhcp,ip6=dhcp,gw=192.168.56.100,gw6=2001:0:1234::c1c0:abcd:876')
199
+ assert_includes interfaces_to_add, { net0: 'name=eth0,bridge=vmbr0,ip=dhcp,ip6=dhcp,gw=192.168.56.100,gw6=2001:0:1234::c1c0:abcd:876' }
200
+ assert_includes interfaces_to_add, { net1: 'name=eth1,bridge=vmbr0,ip=dhcp,ip6=dhcp,gw=192.168.56.100,gw6=2001:0:1234::c1c0:abcd:876' }
201
201
  end
202
202
  end
203
203
  end
@@ -35,9 +35,8 @@ module ForemanFogProxmox
35
35
  'type' => 'qemu',
36
36
  'config_attributes' => {
37
37
  'memory' => '536870912',
38
- 'min_memory' => '',
39
- 'ballon' => '',
40
- 'shares' => '',
38
+ 'balloon' => '268435456',
39
+ 'shares' => '5',
41
40
  'cpu_type' => 'kvm64',
42
41
  'spectre' => '1',
43
42
  'pcid' => '0',
@@ -83,6 +82,8 @@ module ForemanFogProxmox
83
82
  assert_equal '1', vm['sockets']
84
83
  assert_equal 'cputype=kvm64,flags=+spec-ctrl', vm[:cpu]
85
84
  assert_equal 536_870_912, vm[:memory]
85
+ assert_equal 268_435_456, vm[:balloon]
86
+ assert_equal 5, vm[:shares]
86
87
  assert_equal 'local-lvm:1073741824,cache=none', vm[:scsi0]
87
88
  assert_equal 'model=virtio,bridge=vmbr0,firewall=0,link_down=0', vm[:net0]
88
89
  assert_not vm.key?(:config)
@@ -111,7 +112,7 @@ module ForemanFogProxmox
111
112
  interfaces_to_delete = []
112
113
  interfaces_to_add = []
113
114
  add_server_interface(host['interfaces_attributes']['0'], interfaces_to_delete, interfaces_to_add)
114
- assert interfaces_to_delete.empty?
115
+ assert_empty interfaces_to_delete
115
116
  assert_equal 1, interfaces_to_add.length
116
117
  assert interfaces_to_add[0].key?(:net0)
117
118
  assert_equal 'model=virtio,bridge=vmbr0,firewall=0,link_down=0', interfaces_to_add[0][:net0]
@@ -121,7 +122,7 @@ module ForemanFogProxmox
121
122
  interfaces_to_delete = []
122
123
  interfaces_to_add = []
123
124
  add_server_interface(host['interfaces_attributes']['1'], interfaces_to_delete, interfaces_to_add)
124
- assert interfaces_to_delete.empty?
125
+ assert_empty interfaces_to_delete
125
126
  assert_equal 1, interfaces_to_add.length
126
127
  assert interfaces_to_add[0].key?(:net1)
127
128
  assert_equal 'model=e1000,bridge=vmbr0,firewall=0,link_down=0', interfaces_to_add[0][:net1]
@@ -131,17 +132,17 @@ module ForemanFogProxmox
131
132
  interfaces_to_delete = []
132
133
  interfaces_to_add = []
133
134
  add_server_interface(host_delete['interfaces_attributes']['0'], interfaces_to_delete, interfaces_to_add)
134
- assert interfaces_to_add.empty?
135
+ assert_empty interfaces_to_add
135
136
  assert_equal 1, interfaces_to_delete.length
136
137
  assert_equal 'net0', interfaces_to_delete[0]
137
138
  end
138
139
 
139
140
  test '#interfaces' do
140
141
  interfaces_to_add, interfaces_to_delete = parse_server_interfaces(host['interfaces_attributes'])
141
- assert interfaces_to_delete.empty?
142
+ assert_empty interfaces_to_delete
142
143
  assert_equal 2, interfaces_to_add.length
143
- assert interfaces_to_add.include?(net0: 'model=virtio,bridge=vmbr0,firewall=0,link_down=0')
144
- assert interfaces_to_add.include?(net1: 'model=e1000,bridge=vmbr0,firewall=0,link_down=0')
144
+ assert_includes interfaces_to_add, { net0: 'model=virtio,bridge=vmbr0,firewall=0,link_down=0' }
145
+ assert_includes interfaces_to_add, { net1: 'model=e1000,bridge=vmbr0,firewall=0,link_down=0' }
145
146
  end
146
147
  end
147
148
  end
@@ -209,7 +209,7 @@ module ForemanFogProxmox
209
209
 
210
210
  it '#container swap empty' do
211
211
  convert_memory_size(host_container['config_attributes'], 'swap')
212
- assert host_container['config_attributes']['swap'].empty?
212
+ assert_empty host_container['config_attributes']['swap']
213
213
  end
214
214
  end
215
215
  end
@@ -96,7 +96,11 @@ module ForemanFogProxmox
96
96
  assert_equal volume_attributes, vm_attrs[:volumes_attributes]['0']
97
97
  assert_not vm_attrs[:config_attributes].key?(:interfaces)
98
98
  assert vm_attrs.key?(:interfaces_attributes)
99
- assert_equal interface_attributes, vm_attrs[:interfaces_attributes]['0']
99
+ assert_equal interface_attributes[:id], vm_attrs[:interfaces_attributes]['0'][:id]
100
+ assert_equal interface_attributes[:id], vm_attrs[:interfaces_attributes]['0'][:identifier]
101
+ assert_equal interface_attributes[:macaddr], vm_attrs[:interfaces_attributes]['0'][:mac]
102
+ assert_equal interface_attributes[:model], vm_attrs[:interfaces_attributes]['0'][:compute_attributes][:model]
103
+ assert_equal interface_attributes[:bridge], vm_attrs[:interfaces_attributes]['0'][:compute_attributes][:bridge]
100
104
  end
101
105
 
102
106
  it 'converts a container to hash' do
@@ -109,7 +113,11 @@ module ForemanFogProxmox
109
113
  assert vm_attrs.key?(:volumes_attributes)
110
114
  assert_equal volume_attributes, vm_attrs[:volumes_attributes]['0']
111
115
  assert vm_attrs.key?(:interfaces_attributes)
112
- assert_equal interface_attributes, vm_attrs[:interfaces_attributes]['0']
116
+ assert_equal interface_attributes[:id], vm_attrs[:interfaces_attributes]['0'][:id]
117
+ assert_equal interface_attributes[:id], vm_attrs[:interfaces_attributes]['0'][:identifier]
118
+ assert_equal interface_attributes[:name], vm_attrs[:interfaces_attributes]['0'][:compute_attributes][:name]
119
+ assert_equal interface_attributes[:mac], vm_attrs[:interfaces_attributes]['0'][:compute_attributes][:mac]
120
+ assert_equal interface_attributes[:bridge], vm_attrs[:interfaces_attributes]['0'][:compute_attributes][:bridge]
113
121
  end
114
122
  end
115
123
  end
@@ -72,22 +72,22 @@ module ForemanFogProxmox
72
72
 
73
73
  it 'is true with 5.4-3' do
74
74
  @identity_client.stubs(:read_version).returns(supported_version)
75
- assert_equal true, @cr.version_suitable?
75
+ assert @cr.version_suitable?
76
76
  end
77
77
 
78
78
  it 'is true with 6.0-1' do
79
79
  @identity_client.stubs(:read_version).returns(supported_6_version)
80
- assert_equal true, @cr.version_suitable?
80
+ assert @cr.version_suitable?
81
81
  end
82
82
 
83
83
  it 'is true with 6.1-3' do
84
84
  @identity_client.stubs(:read_version).returns(supported_6_1_version)
85
- assert_equal true, @cr.version_suitable?
85
+ assert @cr.version_suitable?
86
86
  end
87
87
 
88
88
  it 'is false with 5.2-2' do
89
89
  @identity_client.stubs(:read_version).returns(unsupported_version)
90
- assert_equal false, @cr.version_suitable?
90
+ assert_not @cr.version_suitable?
91
91
  end
92
92
  end
93
93
  end
@@ -253,6 +253,20 @@ module ForemanFogProxmox
253
253
  cr.create_vm(args)
254
254
  end
255
255
 
256
+ it 'creates container within pool' do
257
+ args = { vmid: '100', type: 'lxc', node_id: 'pve', start_after_create: '0', pool: 'pool1' }
258
+ servers = mock('servers')
259
+ servers.stubs(:id_valid?).returns(true)
260
+ containers = mock('containers')
261
+ vm = mock('vm')
262
+ containers.stubs(:create).with(vmid: 100, type: 'lxc', node_id: 'pve', start_after_create: '0', pool: 'pool1').returns(vm)
263
+ cr = mock_node_servers_containers(ForemanFogProxmox::Proxmox.new, servers, containers)
264
+ cr.stubs(:convert_sizes).with(args)
265
+ cr.stubs(:parse_container_vm).with(args).returns(args)
266
+ cr.stubs(:find_vm_by_uuid).with((args[:vmid]).to_s).returns(vm)
267
+ cr.create_vm(args)
268
+ end
269
+
256
270
  it 'clones container' do
257
271
  args = { vmid: '100', type: 'lxc', image_id: '999', name: 'name' }
258
272
  servers = mock('servers')
@@ -31,7 +31,7 @@ module ForemanFogProxmox
31
31
  include ProxmoxVmHelper
32
32
 
33
33
  describe 'create_vm' do
34
- it 'raises Foreman::Exception when vmid is invalid' do
34
+ it 'raises Foreman::Exception when vmid <= 100 and vmid > 0' do
35
35
  args = { vmid: '100' }
36
36
  servers = mock('servers')
37
37
  servers.stubs(:id_valid?).returns(false)
@@ -42,6 +42,20 @@ module ForemanFogProxmox
42
42
  assert err.message.end_with?('invalid vmid=100')
43
43
  end
44
44
 
45
+ it 'computes next vmid when vmid == 0 and creates server' do
46
+ args = { vmid: '0', type: 'qemu', node_id: 'pve', start_after_create: '0' }
47
+ servers = mock('servers')
48
+ servers.stubs(:id_valid?).returns(true)
49
+ servers.stubs(:next_id).returns('101')
50
+ cr = mock_node_servers(ForemanFogProxmox::Proxmox.new, servers)
51
+ cr.stubs(:convert_sizes).with(args)
52
+ cr.stubs(:parse_server_vm).with(args).returns(args)
53
+ servers.stubs(:create).with(args)
54
+ vm = mock('vm')
55
+ cr.stubs(:find_vm_by_uuid).with((args[:vmid]).to_s).returns(vm)
56
+ cr.create_vm(args)
57
+ end
58
+
45
59
  it 'creates server without bootstart' do
46
60
  args = { vmid: '100', type: 'qemu', node_id: 'pve', start_after_create: '0' }
47
61
  servers = mock('servers')
@@ -69,6 +83,20 @@ module ForemanFogProxmox
69
83
  cr.create_vm(args)
70
84
  end
71
85
 
86
+ it 'creates server within pool' do
87
+ args = { vmid: '100', type: 'qemu', node_id: 'pve', start_after_create: '0', pool: 'pool1' }
88
+ servers = mock('servers')
89
+ servers.stubs(:id_valid?).returns(true)
90
+ cr = mock_node_servers(ForemanFogProxmox::Proxmox.new, servers)
91
+ cr.stubs(:convert_sizes).with(args)
92
+ cr.stubs(:parse_server_vm).with(args).returns(args)
93
+ vm = mock('vm')
94
+ servers.stubs(:create).with(args).returns(vm)
95
+ cr.stubs(:find_vm_by_uuid).with((args[:vmid]).to_s).returns(vm)
96
+ cr.stubs(:start_on_boot).with(vm, args).returns(vm)
97
+ cr.create_vm(args)
98
+ end
99
+
72
100
  it 'clones server' do
73
101
  args = { vmid: '100', type: 'qemu', image_id: '999', name: 'name' }
74
102
  servers = mock('servers')
@@ -126,6 +126,97 @@ module ForemanFogProxmox
126
126
  vm.expects(:update, expected_config_attr)
127
127
  @cr.save_vm(uuid, new_attributes)
128
128
  end
129
+
130
+ it 'saves server config with modified pool' do
131
+ uuid = '100'
132
+ config = mock('config')
133
+ config.stubs(:pool).returns('pool1')
134
+ config.expects(:pool=).with('pool1')
135
+ vm = mock('vm')
136
+ vm.stubs(:config).returns(config)
137
+ vm.stubs(:container?).returns(false)
138
+ vm.stubs(:type).returns('qemu')
139
+ vm.stubs(:node_id).returns('pve')
140
+ vm.stubs(:vmid).returns(uuid)
141
+ @cr.stubs(:find_vm_by_uuid).returns(vm)
142
+ identity_client = mock('identity_client')
143
+ pools = mock('pools')
144
+ pool1 = mock('pool1')
145
+ pool1.stubs(:poolid).returns('pool1')
146
+ pool1.stubs(:has_server?).with('100').returns(true)
147
+ pool1.expects(:remove_server).with(uuid)
148
+ pool2 = mock('pool2')
149
+ pool2.stubs(:poolid).returns('pool2')
150
+ pool2.stubs(:has_server?).with('100').returns(false)
151
+ pool2.expects(:add_server).with(uuid)
152
+ pools.stubs(:all).returns([pool1, pool2])
153
+ pools.expects(:get).with('pool1').returns(pool1)
154
+ pools.expects(:get).with('pool2').returns(pool2)
155
+ identity_client.stubs(:pools).returns(pools)
156
+ @cr.stubs(:identity_client).returns(identity_client)
157
+ attr = { 'templated' => '0', 'node_id' => 'pve', 'pool' => 'pool2', 'config_attributes' => { 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0' } }.with_indifferent_access
158
+ @cr.stubs(:parse_server_vm).returns('vmid' => '100', 'node_id' => 'pve', 'type' => 'qemu', 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0', 'pool' => 'pool2')
159
+ vm.expects(:update).with({ 'node_id' => 'pve', 'type' => 'qemu', 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0' }.with_indifferent_access)
160
+ @cr.save_vm(uuid, attr)
161
+ end
162
+
163
+ it 'saves server config with removed pool' do
164
+ uuid = '100'
165
+ config = mock('config')
166
+ config.expects(:pool=).with('pool1')
167
+ config.stubs(:pool).returns('pool1')
168
+ vm = mock('vm')
169
+ vm.stubs(:config).returns(config)
170
+ vm.stubs(:container?).returns(false)
171
+ vm.stubs(:type).returns('qemu')
172
+ vm.stubs(:node_id).returns('pve')
173
+ vm.stubs(:vmid).returns(uuid)
174
+ @cr.stubs(:find_vm_by_uuid).returns(vm)
175
+ identity_client = mock('identity_client')
176
+ pools = mock('pools')
177
+ pool1 = mock('pool1')
178
+ pool1.stubs(:has_server?).with('100').returns(true)
179
+ pool1.stubs(:poolid).returns('pool1')
180
+ pool1.expects(:remove_server).with(uuid)
181
+ pools.stubs(:all).returns([pool1])
182
+ pools.expects(:get).with('pool1').returns(pool1)
183
+ pools.expects(:get).with('').returns(nil)
184
+ identity_client.stubs(:pools).returns(pools)
185
+ @cr.stubs(:identity_client).returns(identity_client)
186
+ attr = { 'templated' => '0', 'node_id' => 'pve', 'pool' => '', 'config_attributes' => { 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0' } }.with_indifferent_access
187
+ @cr.stubs(:parse_server_vm).returns('vmid' => '100', 'node_id' => 'pve', 'type' => 'qemu', 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0', 'pool' => '')
188
+ vm.expects(:update).with({ 'node_id' => 'pve', 'type' => 'qemu', 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0' }.with_indifferent_access)
189
+ @cr.save_vm(uuid, attr)
190
+ end
191
+
192
+ it 'saves server config with added pool' do
193
+ uuid = '100'
194
+ config = mock('config')
195
+ config.expects(:pool=).with(nil)
196
+ config.stubs(:pool).returns(nil)
197
+ vm = mock('vm')
198
+ vm.stubs(:config).returns(config)
199
+ vm.stubs(:container?).returns(false)
200
+ vm.stubs(:type).returns('qemu')
201
+ vm.stubs(:node_id).returns('pve')
202
+ vm.stubs(:vmid).returns(uuid)
203
+ @cr.stubs(:find_vm_by_uuid).returns(vm)
204
+ identity_client = mock('identity_client')
205
+ pools = mock('pools')
206
+ pool2 = mock('pool2')
207
+ pool2.stubs(:has_server?).with('100').returns(false)
208
+ pool2.stubs(:poolid).returns('pool2')
209
+ pool2.expects(:add_server).with(uuid)
210
+ pools.stubs(:all).returns([pool2])
211
+ pools.expects(:get).with('pool2').returns(pool2)
212
+ pools.expects(:get).with('').returns(nil)
213
+ identity_client.stubs(:pools).returns(pools)
214
+ @cr.stubs(:identity_client).returns(identity_client)
215
+ attr = { 'templated' => '0', 'node_id' => 'pve', 'pool' => 'pool2', 'config_attributes' => { 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0' } }.with_indifferent_access
216
+ @cr.stubs(:parse_server_vm).returns('vmid' => '100', 'node_id' => 'pve', 'type' => 'qemu', 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0', 'pool' => 'pool2')
217
+ vm.expects(:update).with({ 'node_id' => 'pve', 'type' => 'qemu', 'cores' => '1', 'cpulimit' => '1', 'onboot' => '0' }.with_indifferent_access)
218
+ @cr.save_vm(uuid, attr)
219
+ end
129
220
  end
130
221
  end
131
222
  end
@@ -49,14 +49,19 @@ module ForemanFogProxmox
49
49
  it 'finds vm on other node in cluster' do
50
50
  args = { vmid: '100', type: 'qemu' }
51
51
  servers = mock('servers')
52
+ vm = mock('vm')
53
+ vm.stubs(:vmid).returns(args[:vmid])
54
+ config = mock('config')
55
+ config.expects(:pool=, nil)
56
+ vm.stubs(:config).returns(config)
52
57
  servers.stubs(:id_valid?).returns(true)
53
- servers.stubs(:get).with(args[:vmid]).returns(args)
58
+ servers.stubs(:get).with(args[:vmid]).returns(vm)
54
59
  cr = mock_cluster_nodes_servers_containers(
55
60
  ForemanFogProxmox::Proxmox.new,
56
61
  empty_servers, empty_servers, # node1
57
62
  servers, empty_servers # node2
58
63
  )
59
- assert_equal args, cr.find_vm_by_uuid(args[:vmid])
64
+ assert_equal vm, cr.find_vm_by_uuid(args[:vmid])
60
65
  end
61
66
  end
62
67
  end
@@ -57,7 +57,6 @@ module ForemanFogProxmox
57
57
  end
58
58
  end
59
59
  end
60
- # rubocop:disable Lint/UselessComparison
61
60
  describe 'semverclass comparators' do
62
61
  it '#5.3.0 <= 5.4.3 returns true' do
63
62
  assert ForemanFogProxmox::Semver.to_semver('5.3.0') <= ForemanFogProxmox::Semver.to_semver('5.4.3')
@@ -78,7 +77,7 @@ module ForemanFogProxmox
78
77
  assert ForemanFogProxmox::Semver.to_semver('1.0.10') <= ForemanFogProxmox::Semver.to_semver('1.0.20')
79
78
  end
80
79
  it '#1.2.3-beta == 1.2.3-beta returns true' do
81
- assert ForemanFogProxmox::Semver.to_semver('1.2.3-beta') == ForemanFogProxmox::Semver.to_semver('1.2.3-beta')
80
+ assert_equal ForemanFogProxmox::Semver.to_semver('1.2.3-beta'), ForemanFogProxmox::Semver.to_semver('1.2.3-beta')
82
81
  end
83
82
  it '#1.2.3-beta >= 1.-beta raises ArgumentError' do
84
83
  assert_raises ArgumentError do
@@ -101,13 +100,12 @@ module ForemanFogProxmox
101
100
  assert_equal 20, ForemanFogProxmox::Semver.to_semver('1.20.0').minor
102
101
  assert_equal 0, ForemanFogProxmox::Semver.to_semver('1.20.0').patch
103
102
  assert ForemanFogProxmox::Semver.to_semver('0.10.2').major < ForemanFogProxmox::Semver.to_semver('1.20.0').major
104
- assert_equal false, ForemanFogProxmox::Semver.to_semver('0.10.2').major == ForemanFogProxmox::Semver.to_semver('1.20.0').major
105
- assert_equal false, ForemanFogProxmox::Semver.to_semver('0.10.2').minor == ForemanFogProxmox::Semver.to_semver('1.20.0').minor
103
+ assert_not ForemanFogProxmox::Semver.to_semver('0.10.2').major == ForemanFogProxmox::Semver.to_semver('1.20.0').major
104
+ assert_not ForemanFogProxmox::Semver.to_semver('0.10.2').minor == ForemanFogProxmox::Semver.to_semver('1.20.0').minor
106
105
  assert ForemanFogProxmox::Semver.to_semver('0.10.2').minor < ForemanFogProxmox::Semver.to_semver('1.20.0').minor
107
106
  assert ForemanFogProxmox::Semver.to_semver('0.10.2').patch > ForemanFogProxmox::Semver.to_semver('1.20.0').patch
108
107
  assert ForemanFogProxmox::Semver.to_semver('0.10.2') < ForemanFogProxmox::Semver.to_semver('1.20.0')
109
108
  end
110
109
  end
111
- # rubocop:enable Lint/UselessComparison
112
110
  end
113
111
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_fog_proxmox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Robert
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-02-11 00:00:00.000000000 Z
12
+ date: 2020-07-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: deface
@@ -29,16 +29,16 @@ dependencies:
29
29
  name: fog-proxmox
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: '0.10'
34
+ version: '0.13'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ">="
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: '0.10'
41
+ version: '0.13'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rdoc
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -121,6 +121,7 @@ files:
121
121
  - app/models/foreman_fog_proxmox/proxmox_images.rb
122
122
  - app/models/foreman_fog_proxmox/proxmox_interfaces.rb
123
123
  - app/models/foreman_fog_proxmox/proxmox_operating_systems.rb
124
+ - app/models/foreman_fog_proxmox/proxmox_pools.rb
124
125
  - app/models/foreman_fog_proxmox/proxmox_token_expiration.rb
125
126
  - app/models/foreman_fog_proxmox/proxmox_version.rb
126
127
  - app/models/foreman_fog_proxmox/proxmox_vm_commands.rb
@@ -174,13 +175,9 @@ files:
174
175
  - lib/foreman_fog_proxmox/version.rb
175
176
  - lib/tasks/foreman_fog_proxmox_tasks.rake
176
177
  - locale/Makefile
177
- - locale/en/foreman_fog_proxmox.edit.po
178
178
  - locale/en/foreman_fog_proxmox.po
179
- - locale/en/foreman_fog_proxmox.po.time_stamp
180
179
  - locale/foreman_fog_proxmox.pot
181
- - locale/fr/foreman_fog_proxmox.edit.po
182
180
  - locale/fr/foreman_fog_proxmox.po
183
- - locale/fr/foreman_fog_proxmox.po.time_stamp
184
181
  - locale/gemspec.rb
185
182
  - test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb
186
183
  - test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb
@@ -228,25 +225,25 @@ signing_key:
228
225
  specification_version: 4
229
226
  summary: Foreman plugin that adds Proxmox VE compute resource using fog-proxmox
230
227
  test_files:
231
- - test/test_plugin_helper.rb
232
- - test/functional/compute_resources_controller_test.rb
233
- - test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb
234
- - test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb
228
+ - test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb
229
+ - test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb
230
+ - test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb
231
+ - test/factories/proxmox_factory.rb
235
232
  - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_volumes_test.rb
233
+ - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb
234
+ - test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb
236
235
  - test/unit/foreman_fog_proxmox/proxmox_version_test.rb
236
+ - test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb
237
237
  - test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb
238
- - test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb
239
238
  - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb
240
- - test/unit/foreman_fog_proxmox/semver_test.rb
241
239
  - test/unit/foreman_fog_proxmox/proxmox_images_test.rb
242
- - test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb
243
240
  - test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb
241
+ - test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb
242
+ - test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb
243
+ - test/unit/foreman_fog_proxmox/proxmox_test.rb
244
+ - test/unit/foreman_fog_proxmox/semver_test.rb
245
+ - test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
244
246
  - test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
245
247
  - test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb
246
- - test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
247
- - test/unit/foreman_fog_proxmox/proxmox_test.rb
248
- - test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb
249
- - test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb
250
- - test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb
251
- - test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb
252
- - test/factories/proxmox_factory.rb
248
+ - test/test_plugin_helper.rb
249
+ - test/functional/compute_resources_controller_test.rb