foreman_fog_proxmox 0.12.0
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.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +290 -0
- data/Rakefile +49 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_compute_resource.js +33 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +187 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_container.js +24 -0
- data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_server.js +125 -0
- data/app/controllers/concerns/foreman_fog_proxmox/controller/parameters/compute_resource.rb +41 -0
- data/app/controllers/foreman_fog_proxmox/compute_resources_controller.rb +86 -0
- data/app/helpers/node_dashboard_helper.rb +35 -0
- data/app/helpers/proxmox_compute_selectors_helper.rb +184 -0
- data/app/helpers/proxmox_container_helper.rb +163 -0
- data/app/helpers/proxmox_form_helper.rb +70 -0
- data/app/helpers/proxmox_server_helper.rb +155 -0
- data/app/helpers/proxmox_vm_helper.rb +88 -0
- data/app/models/concerns/fog_extensions/proxmox/disk.rb +29 -0
- data/app/models/concerns/fog_extensions/proxmox/interface.rb +40 -0
- data/app/models/concerns/fog_extensions/proxmox/node.rb +41 -0
- data/app/models/concerns/fog_extensions/proxmox/server.rb +93 -0
- data/app/models/concerns/fog_extensions/proxmox/server_config.rb +71 -0
- data/app/models/concerns/fog_extensions/proxmox/volume.rb +29 -0
- data/app/models/concerns/host_ext/proxmox/interfaces.rb +52 -0
- data/app/models/concerns/orchestration/proxmox/compute.rb +42 -0
- data/app/models/foreman_fog_proxmox/options_select.rb +36 -0
- data/app/models/foreman_fog_proxmox/proxmox.rb +133 -0
- data/app/models/foreman_fog_proxmox/proxmox_compute_attributes.rb +67 -0
- data/app/models/foreman_fog_proxmox/proxmox_connection.rb +67 -0
- data/app/models/foreman_fog_proxmox/proxmox_console.rb +41 -0
- data/app/models/foreman_fog_proxmox/proxmox_images.rb +61 -0
- data/app/models/foreman_fog_proxmox/proxmox_interfaces.rb +103 -0
- data/app/models/foreman_fog_proxmox/proxmox_operating_systems.rb +49 -0
- data/app/models/foreman_fog_proxmox/proxmox_pools.rb +56 -0
- data/app/models/foreman_fog_proxmox/proxmox_token_expiration.rb +30 -0
- data/app/models/foreman_fog_proxmox/proxmox_version.rb +36 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb +116 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_new.rb +178 -0
- data/app/models/foreman_fog_proxmox/proxmox_vm_queries.rb +75 -0
- data/app/models/foreman_fog_proxmox/proxmox_volumes.rb +94 -0
- data/app/models/foreman_fog_proxmox/vms.rb +37 -0
- data/app/overrides/compute_resources_vms/form/add_clone_to_new_vm_compute_detail.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_from_profile_to_compute_attributes_form.rb +34 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_node_to_new_form.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_networks_form.rb +34 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_nic_provider_specific_form.rb +26 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_edit.rb +25 -0
- data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_new_volume.rb +25 -0
- data/app/overrides/compute_resources_vms/form/remove_new_vm_from_removable_layout.rb +25 -0
- data/app/services/foreman_fog_proxmox/node_dashboard/data.rb +37 -0
- data/app/views/api/v2/compute_resources/proxmox.json.rabl +3 -0
- data/app/views/compute_resources/form/_proxmox.html.erb +29 -0
- data/app/views/compute_resources/show/_proxmox.html.erb +37 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_attributes_form.html.erb +23 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_form.html.erb +23 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_hosts_compute_detail_form.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_node_to_new_form.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_form.html.erb +28 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_new_childs_form.html.erb +32 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_nic_provider_specific_form.html.erb +30 -0
- data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_volumes_edit.html.erb +71 -0
- data/app/views/compute_resources_vms/form/proxmox/_base.html.erb +39 -0
- data/app/views/compute_resources_vms/form/proxmox/_general.html.erb +39 -0
- data/app/views/compute_resources_vms/form/proxmox/_network.html.erb +19 -0
- data/app/views/compute_resources_vms/form/proxmox/_removable_layout.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_advanced.html.erb +31 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_config.html.erb +41 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_extended.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_network.html.erb +33 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_volume_mp.html.erb +27 -0
- data/app/views/compute_resources_vms/form/proxmox/container/_volume_rootfs.html.erb +24 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_advanced.html.erb +31 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_config.html.erb +60 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_network.html.erb +30 -0
- data/app/views/compute_resources_vms/form/proxmox/server/_volume.html.erb +28 -0
- data/app/views/compute_resources_vms/index/_proxmox.html.erb +49 -0
- data/app/views/compute_resources_vms/show/_proxmox.html.erb +42 -0
- data/app/views/dashboard/_foreman_fog_proxmox_widget.erb +21 -0
- data/app/views/images/form/_proxmox.html.erb +21 -0
- data/config/routes.rb +30 -0
- data/lib/foreman_fog_proxmox.rb +23 -0
- data/lib/foreman_fog_proxmox/engine.rb +105 -0
- data/lib/foreman_fog_proxmox/semver.rb +102 -0
- data/lib/foreman_fog_proxmox/value.rb +26 -0
- data/lib/foreman_fog_proxmox/version.rb +22 -0
- data/lib/tasks/foreman_fog_proxmox_tasks.rake +37 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_fog_proxmox.po +401 -0
- data/locale/foreman_fog_proxmox.pot +627 -0
- data/locale/fr/foreman_fog_proxmox.po +401 -0
- data/locale/gemspec.rb +4 -0
- data/test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb +137 -0
- data/test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb +87 -0
- data/test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb +134 -0
- data/test/factories/proxmox_factory.rb +79 -0
- data/test/functional/compute_resources_controller_test.rb +48 -0
- data/test/test_plugin_helper.rb +19 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb +204 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb +149 -0
- data/test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb +216 -0
- data/test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb +124 -0
- data/test/unit/foreman_fog_proxmox/proxmox_images_test.rb +52 -0
- data/test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb +117 -0
- data/test/unit/foreman_fog_proxmox/proxmox_test.rb +58 -0
- data/test/unit/foreman_fog_proxmox/proxmox_version_test.rb +94 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb +280 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb +110 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb +222 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_volumes_test.rb +308 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb +43 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb +71 -0
- data/test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb +68 -0
- data/test/unit/foreman_fog_proxmox/semver_test.rb +111 -0
- metadata +249 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of ForemanFogProxmox.
|
6
|
+
|
7
|
+
# ForemanFogProxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# ForemanFogProxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'test_plugin_helper'
|
21
|
+
require 'models/compute_resources/compute_resource_test_helpers'
|
22
|
+
require 'factories/foreman_fog_proxmox/proxmox_node_mock_factory'
|
23
|
+
require 'factories/foreman_fog_proxmox/proxmox_server_mock_factory'
|
24
|
+
require 'factories/foreman_fog_proxmox/proxmox_container_mock_factory'
|
25
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
26
|
+
|
27
|
+
module ForemanFogProxmox
|
28
|
+
class ProxmoxVmCommandsServerTest < ActiveSupport::TestCase
|
29
|
+
include ComputeResourceTestHelpers
|
30
|
+
include ProxmoxNodeMockFactory
|
31
|
+
include ProxmoxServerMockFactory
|
32
|
+
include ProxmoxContainerMockFactory
|
33
|
+
include ProxmoxVmHelper
|
34
|
+
|
35
|
+
describe 'destroy_vm' do
|
36
|
+
it 'handles situation when vm is not present' do
|
37
|
+
cr = mock_cr_servers(ForemanFogProxmox::Proxmox.new, empty_servers)
|
38
|
+
cr.expects(:find_vm_by_uuid).raises(ActiveRecord::RecordNotFound)
|
39
|
+
assert cr.destroy_vm('abc')
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of ForemanFogProxmox.
|
6
|
+
|
7
|
+
# ForemanFogProxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# ForemanFogProxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'test_plugin_helper'
|
21
|
+
require 'models/compute_resources/compute_resource_test_helpers'
|
22
|
+
require 'factories/foreman_fog_proxmox/proxmox_node_mock_factory'
|
23
|
+
require 'factories/foreman_fog_proxmox/proxmox_server_mock_factory'
|
24
|
+
require 'factories/foreman_fog_proxmox/proxmox_container_mock_factory'
|
25
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
26
|
+
|
27
|
+
module ForemanFogProxmox
|
28
|
+
class ProxmoxVmNewTest < ActiveSupport::TestCase
|
29
|
+
include ComputeResourceTestHelpers
|
30
|
+
include ProxmoxNodeMockFactory
|
31
|
+
include ProxmoxServerMockFactory
|
32
|
+
include ProxmoxContainerMockFactory
|
33
|
+
include ProxmoxVmHelper
|
34
|
+
|
35
|
+
describe 'new_vm' do
|
36
|
+
before do
|
37
|
+
@cr = FactoryBot.build_stubbed(:proxmox_cr)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'new server with attr empty' do
|
41
|
+
attr = {}
|
42
|
+
vm = mock('vm')
|
43
|
+
config = mock('config')
|
44
|
+
config.stubs(:inspect).returns('config')
|
45
|
+
vm.stubs(:config).returns(config)
|
46
|
+
@cr.stubs(:new_server_vm).with(attr).returns(vm)
|
47
|
+
assert_equal vm, @cr.new_vm(attr)
|
48
|
+
end
|
49
|
+
|
50
|
+
it 'new server with attr not empty' do
|
51
|
+
attr = { 'type' => 'qemu' }
|
52
|
+
vm = mock('vm')
|
53
|
+
config = mock('config')
|
54
|
+
config.stubs(:inspect).returns('config')
|
55
|
+
vm.stubs(:config).returns(config)
|
56
|
+
@cr.stubs(:new_server_vm).with(attr).returns(vm)
|
57
|
+
assert_equal vm, @cr.new_vm(attr)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'new container with attr not empty' do
|
61
|
+
attr = { 'type' => 'lxc' }
|
62
|
+
vm = mock('vm')
|
63
|
+
config = mock('config')
|
64
|
+
config.stubs(:inspect).returns('config')
|
65
|
+
vm.stubs(:config).returns(config)
|
66
|
+
@cr.stubs(:new_container_vm).with(attr).returns(vm)
|
67
|
+
assert_equal vm, @cr.new_vm(attr)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of ForemanFogProxmox.
|
6
|
+
|
7
|
+
# ForemanFogProxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# ForemanFogProxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'test_plugin_helper'
|
21
|
+
require 'models/compute_resources/compute_resource_test_helpers'
|
22
|
+
require 'factories/foreman_fog_proxmox/proxmox_node_mock_factory'
|
23
|
+
require 'factories/foreman_fog_proxmox/proxmox_server_mock_factory'
|
24
|
+
require 'factories/foreman_fog_proxmox/proxmox_container_mock_factory'
|
25
|
+
require 'active_support/core_ext/hash/indifferent_access'
|
26
|
+
|
27
|
+
module ForemanFogProxmox
|
28
|
+
class ProxmoxVmQueriesTest < ActiveSupport::TestCase
|
29
|
+
include ComputeResourceTestHelpers
|
30
|
+
include ProxmoxNodeMockFactory
|
31
|
+
include ProxmoxServerMockFactory
|
32
|
+
include ProxmoxContainerMockFactory
|
33
|
+
include ProxmoxVmHelper
|
34
|
+
|
35
|
+
describe 'find_vm_by_uuid' do
|
36
|
+
it 'returns nil when the uuid does not match' do
|
37
|
+
cr = mock_node_servers_containers(ForemanFogProxmox::Proxmox.new, empty_servers, empty_servers)
|
38
|
+
assert cr.find_vm_by_uuid('100').nil?
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'raises RecordNotFound when the compute raises error' do
|
42
|
+
exception = Fog::Errors::Error.new
|
43
|
+
cr = mock_node_servers(ForemanFogProxmox::Proxmox.new, servers_raising_exception(exception))
|
44
|
+
assert_raises ActiveRecord::RecordNotFound do
|
45
|
+
cr.find_vm_by_uuid('100')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'finds vm on other node in cluster' do
|
50
|
+
args = { vmid: '100', type: 'qemu' }
|
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)
|
57
|
+
servers.stubs(:id_valid?).returns(true)
|
58
|
+
servers.stubs(:get).with(args[:vmid]).returns(vm)
|
59
|
+
cr = mock_cluster_nodes_servers_containers(
|
60
|
+
ForemanFogProxmox::Proxmox.new,
|
61
|
+
empty_servers, empty_servers, # node1
|
62
|
+
servers, empty_servers # node2
|
63
|
+
)
|
64
|
+
assert_equal vm, cr.find_vm_by_uuid(args[:vmid])
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2018 Tristan Robert
|
4
|
+
|
5
|
+
# This file is part of ForemanFogProxmox.
|
6
|
+
|
7
|
+
# ForemanFogProxmox is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
|
12
|
+
# ForemanFogProxmox is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU General Public License for more details.
|
16
|
+
|
17
|
+
# You should have received a copy of the GNU General Public License
|
18
|
+
# along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
|
20
|
+
require 'foreman_fog_proxmox/semver'
|
21
|
+
|
22
|
+
module ForemanFogProxmox
|
23
|
+
class SemverTest < ActiveSupport::TestCase
|
24
|
+
describe 'semver?' do
|
25
|
+
it '#5.3.2 returns true' do
|
26
|
+
assert ForemanFogProxmox::Semver.semver?('5.3.2')
|
27
|
+
end
|
28
|
+
it '#6.0-6 returns true' do
|
29
|
+
assert ForemanFogProxmox::Semver.semver?('6.0-6')
|
30
|
+
end
|
31
|
+
it '#5.3beta returns false' do
|
32
|
+
assert_not ForemanFogProxmox::Semver.semver?('5.3beta')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
describe 'to_semver' do
|
36
|
+
it '#5.3.2 returns SemverClass' do
|
37
|
+
semver = ForemanFogProxmox::Semver.to_semver('5.3.2')
|
38
|
+
assert_not_nil semver
|
39
|
+
assert semver.is_a?(ForemanFogProxmox::Semver::SemverClass)
|
40
|
+
assert_equal 5, semver.major
|
41
|
+
assert_equal 3, semver.minor
|
42
|
+
assert_equal 2, semver.patch
|
43
|
+
assert_equal '', semver.qualifier
|
44
|
+
end
|
45
|
+
it '#6.0-6 returns SemverClass' do
|
46
|
+
semver = ForemanFogProxmox::Semver.to_semver('6.0-6')
|
47
|
+
assert_not_nil semver
|
48
|
+
assert semver.is_a?(ForemanFogProxmox::Semver::SemverClass)
|
49
|
+
assert_equal 6, semver.major
|
50
|
+
assert_equal 0, semver.minor
|
51
|
+
assert_equal 0, semver.patch
|
52
|
+
assert_equal '6', semver.qualifier
|
53
|
+
end
|
54
|
+
it '#5.3beta raises ArgumentError' do
|
55
|
+
assert_raises ArgumentError do
|
56
|
+
ForemanFogProxmox::Semver.to_semver('5.3beta')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
describe 'semverclass comparators' do
|
61
|
+
it '#5.3.0 <= 5.4.3 returns true' do
|
62
|
+
assert ForemanFogProxmox::Semver.to_semver('5.3.0') <= ForemanFogProxmox::Semver.to_semver('5.4.3')
|
63
|
+
end
|
64
|
+
it '#5.3.0 <= 6.0.1 returns true' do
|
65
|
+
assert ForemanFogProxmox::Semver.to_semver('5.3.0') <= ForemanFogProxmox::Semver.to_semver('6.0.1')
|
66
|
+
end
|
67
|
+
it '#5.4.3 < 6.1.0 returns true' do
|
68
|
+
assert ForemanFogProxmox::Semver.to_semver('5.4.3') < ForemanFogProxmox::Semver.to_semver('6.1.0')
|
69
|
+
end
|
70
|
+
it '#6.0.1 < 6.1.0 returns true' do
|
71
|
+
assert ForemanFogProxmox::Semver.to_semver('6.0.1') < ForemanFogProxmox::Semver.to_semver('6.1.0')
|
72
|
+
end
|
73
|
+
it '#2.4.0 >= 1.3.0 returns true' do
|
74
|
+
assert ForemanFogProxmox::Semver.to_semver('2.4.0') >= ForemanFogProxmox::Semver.to_semver('1.3.0')
|
75
|
+
end
|
76
|
+
it '#1.0.10 <= 1.0.20 returns true' do
|
77
|
+
assert ForemanFogProxmox::Semver.to_semver('1.0.10') <= ForemanFogProxmox::Semver.to_semver('1.0.20')
|
78
|
+
end
|
79
|
+
it '#1.2.3-beta == 1.2.3-beta returns true' do
|
80
|
+
assert_equal ForemanFogProxmox::Semver.to_semver('1.2.3-beta'), ForemanFogProxmox::Semver.to_semver('1.2.3-beta')
|
81
|
+
end
|
82
|
+
it '#1.2.3-beta >= 1.-beta raises ArgumentError' do
|
83
|
+
assert_raises ArgumentError do
|
84
|
+
ForemanFogProxmox::Semver.to_semver('1.2.3-beta') >= ForemanFogProxmox::Semver.to_semver('1.-beta')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
it '#SemverClass(1.2.3-beta) >= String(1.-beta) raises TypeError' do
|
88
|
+
assert_raises TypeError do
|
89
|
+
ForemanFogProxmox::Semver.to_semver('1.2.3-beta') >= '1.-beta'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
it '#1.10.2 < 1.20.0 returns true' do
|
93
|
+
assert ForemanFogProxmox::Semver.to_semver('1.10.2') < ForemanFogProxmox::Semver.to_semver('1.20.0')
|
94
|
+
end
|
95
|
+
it '#0.10.2 < 1.20.0 returns true' do
|
96
|
+
assert_equal 0, ForemanFogProxmox::Semver.to_semver('0.10.2').major
|
97
|
+
assert_equal 10, ForemanFogProxmox::Semver.to_semver('0.10.2').minor
|
98
|
+
assert_equal 2, ForemanFogProxmox::Semver.to_semver('0.10.2').patch
|
99
|
+
assert_equal 1, ForemanFogProxmox::Semver.to_semver('1.20.0').major
|
100
|
+
assert_equal 20, ForemanFogProxmox::Semver.to_semver('1.20.0').minor
|
101
|
+
assert_equal 0, ForemanFogProxmox::Semver.to_semver('1.20.0').patch
|
102
|
+
assert ForemanFogProxmox::Semver.to_semver('0.10.2').major < ForemanFogProxmox::Semver.to_semver('1.20.0').major
|
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
|
105
|
+
assert ForemanFogProxmox::Semver.to_semver('0.10.2').minor < ForemanFogProxmox::Semver.to_semver('1.20.0').minor
|
106
|
+
assert ForemanFogProxmox::Semver.to_semver('0.10.2').patch > ForemanFogProxmox::Semver.to_semver('1.20.0').patch
|
107
|
+
assert ForemanFogProxmox::Semver.to_semver('0.10.2') < ForemanFogProxmox::Semver.to_semver('1.20.0')
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
metadata
ADDED
@@ -0,0 +1,249 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman_fog_proxmox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.12.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tristan Robert
|
8
|
+
- The Foreman Team
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2020-07-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: deface
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ">="
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ">="
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: fog-proxmox
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - "~>"
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0.13'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - "~>"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0.13'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rdoc
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rubocop
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: simplecov
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
description: Foreman plugin adds Proxmox VE compute resource using fog-proxmox. It
|
85
|
+
is compatible with Foreman 1.22+
|
86
|
+
email:
|
87
|
+
- tristan.robert.44@gmail.com
|
88
|
+
- theforeman.rubygems@gmail.com
|
89
|
+
executables: []
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files: []
|
92
|
+
files:
|
93
|
+
- LICENSE
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- app/assets/javascripts/foreman_fog_proxmox/proxmox_compute_resource.js
|
97
|
+
- app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js
|
98
|
+
- app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_container.js
|
99
|
+
- app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_server.js
|
100
|
+
- app/controllers/concerns/foreman_fog_proxmox/controller/parameters/compute_resource.rb
|
101
|
+
- app/controllers/foreman_fog_proxmox/compute_resources_controller.rb
|
102
|
+
- app/helpers/node_dashboard_helper.rb
|
103
|
+
- app/helpers/proxmox_compute_selectors_helper.rb
|
104
|
+
- app/helpers/proxmox_container_helper.rb
|
105
|
+
- app/helpers/proxmox_form_helper.rb
|
106
|
+
- app/helpers/proxmox_server_helper.rb
|
107
|
+
- app/helpers/proxmox_vm_helper.rb
|
108
|
+
- app/models/concerns/fog_extensions/proxmox/disk.rb
|
109
|
+
- app/models/concerns/fog_extensions/proxmox/interface.rb
|
110
|
+
- app/models/concerns/fog_extensions/proxmox/node.rb
|
111
|
+
- app/models/concerns/fog_extensions/proxmox/server.rb
|
112
|
+
- app/models/concerns/fog_extensions/proxmox/server_config.rb
|
113
|
+
- app/models/concerns/fog_extensions/proxmox/volume.rb
|
114
|
+
- app/models/concerns/host_ext/proxmox/interfaces.rb
|
115
|
+
- app/models/concerns/orchestration/proxmox/compute.rb
|
116
|
+
- app/models/foreman_fog_proxmox/options_select.rb
|
117
|
+
- app/models/foreman_fog_proxmox/proxmox.rb
|
118
|
+
- app/models/foreman_fog_proxmox/proxmox_compute_attributes.rb
|
119
|
+
- app/models/foreman_fog_proxmox/proxmox_connection.rb
|
120
|
+
- app/models/foreman_fog_proxmox/proxmox_console.rb
|
121
|
+
- app/models/foreman_fog_proxmox/proxmox_images.rb
|
122
|
+
- app/models/foreman_fog_proxmox/proxmox_interfaces.rb
|
123
|
+
- app/models/foreman_fog_proxmox/proxmox_operating_systems.rb
|
124
|
+
- app/models/foreman_fog_proxmox/proxmox_pools.rb
|
125
|
+
- app/models/foreman_fog_proxmox/proxmox_token_expiration.rb
|
126
|
+
- app/models/foreman_fog_proxmox/proxmox_version.rb
|
127
|
+
- app/models/foreman_fog_proxmox/proxmox_vm_commands.rb
|
128
|
+
- app/models/foreman_fog_proxmox/proxmox_vm_new.rb
|
129
|
+
- app/models/foreman_fog_proxmox/proxmox_vm_queries.rb
|
130
|
+
- app/models/foreman_fog_proxmox/proxmox_volumes.rb
|
131
|
+
- app/models/foreman_fog_proxmox/vms.rb
|
132
|
+
- app/overrides/compute_resources_vms/form/add_clone_to_new_vm_compute_detail.rb
|
133
|
+
- app/overrides/compute_resources_vms/form/add_from_profile_to_compute_attributes_form.rb
|
134
|
+
- app/overrides/compute_resources_vms/form/add_vm_type_node_to_new_form.rb
|
135
|
+
- app/overrides/compute_resources_vms/form/add_vm_type_to_networks_form.rb
|
136
|
+
- app/overrides/compute_resources_vms/form/add_vm_type_to_nic_provider_specific_form.rb
|
137
|
+
- app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_edit.rb
|
138
|
+
- app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_new_volume.rb
|
139
|
+
- app/overrides/compute_resources_vms/form/remove_new_vm_from_removable_layout.rb
|
140
|
+
- app/services/foreman_fog_proxmox/node_dashboard/data.rb
|
141
|
+
- app/views/api/v2/compute_resources/proxmox.json.rabl
|
142
|
+
- app/views/compute_resources/form/_proxmox.html.erb
|
143
|
+
- app/views/compute_resources/show/_proxmox.html.erb
|
144
|
+
- app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_attributes_form.html.erb
|
145
|
+
- app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_form.html.erb
|
146
|
+
- app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_hosts_compute_detail_form.html.erb
|
147
|
+
- app/views/compute_resources_vms/form/proxmox/_add_vm_type_node_to_new_form.html.erb
|
148
|
+
- app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_form.html.erb
|
149
|
+
- app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_new_childs_form.html.erb
|
150
|
+
- app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_nic_provider_specific_form.html.erb
|
151
|
+
- app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_volumes_edit.html.erb
|
152
|
+
- app/views/compute_resources_vms/form/proxmox/_base.html.erb
|
153
|
+
- app/views/compute_resources_vms/form/proxmox/_general.html.erb
|
154
|
+
- app/views/compute_resources_vms/form/proxmox/_network.html.erb
|
155
|
+
- app/views/compute_resources_vms/form/proxmox/_removable_layout.html.erb
|
156
|
+
- app/views/compute_resources_vms/form/proxmox/container/_advanced.html.erb
|
157
|
+
- app/views/compute_resources_vms/form/proxmox/container/_config.html.erb
|
158
|
+
- app/views/compute_resources_vms/form/proxmox/container/_extended.html.erb
|
159
|
+
- app/views/compute_resources_vms/form/proxmox/container/_network.html.erb
|
160
|
+
- app/views/compute_resources_vms/form/proxmox/container/_volume_mp.html.erb
|
161
|
+
- app/views/compute_resources_vms/form/proxmox/container/_volume_rootfs.html.erb
|
162
|
+
- app/views/compute_resources_vms/form/proxmox/server/_advanced.html.erb
|
163
|
+
- app/views/compute_resources_vms/form/proxmox/server/_config.html.erb
|
164
|
+
- app/views/compute_resources_vms/form/proxmox/server/_network.html.erb
|
165
|
+
- app/views/compute_resources_vms/form/proxmox/server/_volume.html.erb
|
166
|
+
- app/views/compute_resources_vms/index/_proxmox.html.erb
|
167
|
+
- app/views/compute_resources_vms/show/_proxmox.html.erb
|
168
|
+
- app/views/dashboard/_foreman_fog_proxmox_widget.erb
|
169
|
+
- app/views/images/form/_proxmox.html.erb
|
170
|
+
- config/routes.rb
|
171
|
+
- lib/foreman_fog_proxmox.rb
|
172
|
+
- lib/foreman_fog_proxmox/engine.rb
|
173
|
+
- lib/foreman_fog_proxmox/semver.rb
|
174
|
+
- lib/foreman_fog_proxmox/value.rb
|
175
|
+
- lib/foreman_fog_proxmox/version.rb
|
176
|
+
- lib/tasks/foreman_fog_proxmox_tasks.rake
|
177
|
+
- locale/Makefile
|
178
|
+
- locale/en/foreman_fog_proxmox.po
|
179
|
+
- locale/foreman_fog_proxmox.pot
|
180
|
+
- locale/fr/foreman_fog_proxmox.po
|
181
|
+
- locale/gemspec.rb
|
182
|
+
- test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb
|
183
|
+
- test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb
|
184
|
+
- test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb
|
185
|
+
- test/factories/proxmox_factory.rb
|
186
|
+
- test/functional/compute_resources_controller_test.rb
|
187
|
+
- test/test_plugin_helper.rb
|
188
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb
|
189
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
|
190
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
|
191
|
+
- test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb
|
192
|
+
- test/unit/foreman_fog_proxmox/proxmox_images_test.rb
|
193
|
+
- test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb
|
194
|
+
- test/unit/foreman_fog_proxmox/proxmox_test.rb
|
195
|
+
- test/unit/foreman_fog_proxmox/proxmox_version_test.rb
|
196
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb
|
197
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb
|
198
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb
|
199
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_volumes_test.rb
|
200
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb
|
201
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb
|
202
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb
|
203
|
+
- test/unit/foreman_fog_proxmox/semver_test.rb
|
204
|
+
homepage: https://github.com/theforeman/foreman_fog_proxmox
|
205
|
+
licenses:
|
206
|
+
- GPL-3.0
|
207
|
+
metadata: {}
|
208
|
+
post_install_message:
|
209
|
+
rdoc_options: []
|
210
|
+
require_paths:
|
211
|
+
- lib
|
212
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0'
|
217
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
requirements: []
|
223
|
+
rubygems_version: 3.0.3
|
224
|
+
signing_key:
|
225
|
+
specification_version: 4
|
226
|
+
summary: Foreman plugin that adds Proxmox VE compute resource using fog-proxmox
|
227
|
+
test_files:
|
228
|
+
- test/test_plugin_helper.rb
|
229
|
+
- test/factories/proxmox_factory.rb
|
230
|
+
- test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb
|
231
|
+
- test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb
|
232
|
+
- test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb
|
233
|
+
- test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb
|
234
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_volumes_test.rb
|
235
|
+
- test/unit/foreman_fog_proxmox/proxmox_images_test.rb
|
236
|
+
- test/unit/foreman_fog_proxmox/proxmox_test.rb
|
237
|
+
- test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb
|
238
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb
|
239
|
+
- test/unit/foreman_fog_proxmox/semver_test.rb
|
240
|
+
- test/unit/foreman_fog_proxmox/proxmox_version_test.rb
|
241
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb
|
242
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb
|
243
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb
|
244
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb
|
245
|
+
- test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb
|
246
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb
|
247
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb
|
248
|
+
- test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb
|
249
|
+
- test/functional/compute_resources_controller_test.rb
|