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.

Files changed (113) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +619 -0
  3. data/README.md +290 -0
  4. data/Rakefile +49 -0
  5. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_compute_resource.js +33 -0
  6. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm.js +187 -0
  7. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_container.js +24 -0
  8. data/app/assets/javascripts/foreman_fog_proxmox/proxmox_vm_server.js +125 -0
  9. data/app/controllers/concerns/foreman_fog_proxmox/controller/parameters/compute_resource.rb +41 -0
  10. data/app/controllers/foreman_fog_proxmox/compute_resources_controller.rb +86 -0
  11. data/app/helpers/node_dashboard_helper.rb +35 -0
  12. data/app/helpers/proxmox_compute_selectors_helper.rb +184 -0
  13. data/app/helpers/proxmox_container_helper.rb +163 -0
  14. data/app/helpers/proxmox_form_helper.rb +70 -0
  15. data/app/helpers/proxmox_server_helper.rb +155 -0
  16. data/app/helpers/proxmox_vm_helper.rb +88 -0
  17. data/app/models/concerns/fog_extensions/proxmox/disk.rb +29 -0
  18. data/app/models/concerns/fog_extensions/proxmox/interface.rb +40 -0
  19. data/app/models/concerns/fog_extensions/proxmox/node.rb +41 -0
  20. data/app/models/concerns/fog_extensions/proxmox/server.rb +93 -0
  21. data/app/models/concerns/fog_extensions/proxmox/server_config.rb +71 -0
  22. data/app/models/concerns/fog_extensions/proxmox/volume.rb +29 -0
  23. data/app/models/concerns/host_ext/proxmox/interfaces.rb +52 -0
  24. data/app/models/concerns/orchestration/proxmox/compute.rb +42 -0
  25. data/app/models/foreman_fog_proxmox/options_select.rb +36 -0
  26. data/app/models/foreman_fog_proxmox/proxmox.rb +133 -0
  27. data/app/models/foreman_fog_proxmox/proxmox_compute_attributes.rb +67 -0
  28. data/app/models/foreman_fog_proxmox/proxmox_connection.rb +67 -0
  29. data/app/models/foreman_fog_proxmox/proxmox_console.rb +41 -0
  30. data/app/models/foreman_fog_proxmox/proxmox_images.rb +61 -0
  31. data/app/models/foreman_fog_proxmox/proxmox_interfaces.rb +103 -0
  32. data/app/models/foreman_fog_proxmox/proxmox_operating_systems.rb +49 -0
  33. data/app/models/foreman_fog_proxmox/proxmox_pools.rb +56 -0
  34. data/app/models/foreman_fog_proxmox/proxmox_token_expiration.rb +30 -0
  35. data/app/models/foreman_fog_proxmox/proxmox_version.rb +36 -0
  36. data/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb +116 -0
  37. data/app/models/foreman_fog_proxmox/proxmox_vm_new.rb +178 -0
  38. data/app/models/foreman_fog_proxmox/proxmox_vm_queries.rb +75 -0
  39. data/app/models/foreman_fog_proxmox/proxmox_volumes.rb +94 -0
  40. data/app/models/foreman_fog_proxmox/vms.rb +37 -0
  41. data/app/overrides/compute_resources_vms/form/add_clone_to_new_vm_compute_detail.rb +25 -0
  42. data/app/overrides/compute_resources_vms/form/add_from_profile_to_compute_attributes_form.rb +34 -0
  43. data/app/overrides/compute_resources_vms/form/add_vm_type_node_to_new_form.rb +25 -0
  44. data/app/overrides/compute_resources_vms/form/add_vm_type_to_networks_form.rb +34 -0
  45. data/app/overrides/compute_resources_vms/form/add_vm_type_to_nic_provider_specific_form.rb +26 -0
  46. data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_edit.rb +25 -0
  47. data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_new_volume.rb +25 -0
  48. data/app/overrides/compute_resources_vms/form/remove_new_vm_from_removable_layout.rb +25 -0
  49. data/app/services/foreman_fog_proxmox/node_dashboard/data.rb +37 -0
  50. data/app/views/api/v2/compute_resources/proxmox.json.rabl +3 -0
  51. data/app/views/compute_resources/form/_proxmox.html.erb +29 -0
  52. data/app/views/compute_resources/show/_proxmox.html.erb +37 -0
  53. data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_attributes_form.html.erb +23 -0
  54. data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_form.html.erb +23 -0
  55. data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_hosts_compute_detail_form.html.erb +24 -0
  56. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_node_to_new_form.html.erb +24 -0
  57. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_form.html.erb +28 -0
  58. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_new_childs_form.html.erb +32 -0
  59. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_nic_provider_specific_form.html.erb +30 -0
  60. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_volumes_edit.html.erb +71 -0
  61. data/app/views/compute_resources_vms/form/proxmox/_base.html.erb +39 -0
  62. data/app/views/compute_resources_vms/form/proxmox/_general.html.erb +39 -0
  63. data/app/views/compute_resources_vms/form/proxmox/_network.html.erb +19 -0
  64. data/app/views/compute_resources_vms/form/proxmox/_removable_layout.html.erb +27 -0
  65. data/app/views/compute_resources_vms/form/proxmox/container/_advanced.html.erb +31 -0
  66. data/app/views/compute_resources_vms/form/proxmox/container/_config.html.erb +41 -0
  67. data/app/views/compute_resources_vms/form/proxmox/container/_extended.html.erb +27 -0
  68. data/app/views/compute_resources_vms/form/proxmox/container/_network.html.erb +33 -0
  69. data/app/views/compute_resources_vms/form/proxmox/container/_volume_mp.html.erb +27 -0
  70. data/app/views/compute_resources_vms/form/proxmox/container/_volume_rootfs.html.erb +24 -0
  71. data/app/views/compute_resources_vms/form/proxmox/server/_advanced.html.erb +31 -0
  72. data/app/views/compute_resources_vms/form/proxmox/server/_config.html.erb +60 -0
  73. data/app/views/compute_resources_vms/form/proxmox/server/_network.html.erb +30 -0
  74. data/app/views/compute_resources_vms/form/proxmox/server/_volume.html.erb +28 -0
  75. data/app/views/compute_resources_vms/index/_proxmox.html.erb +49 -0
  76. data/app/views/compute_resources_vms/show/_proxmox.html.erb +42 -0
  77. data/app/views/dashboard/_foreman_fog_proxmox_widget.erb +21 -0
  78. data/app/views/images/form/_proxmox.html.erb +21 -0
  79. data/config/routes.rb +30 -0
  80. data/lib/foreman_fog_proxmox.rb +23 -0
  81. data/lib/foreman_fog_proxmox/engine.rb +105 -0
  82. data/lib/foreman_fog_proxmox/semver.rb +102 -0
  83. data/lib/foreman_fog_proxmox/value.rb +26 -0
  84. data/lib/foreman_fog_proxmox/version.rb +22 -0
  85. data/lib/tasks/foreman_fog_proxmox_tasks.rake +37 -0
  86. data/locale/Makefile +60 -0
  87. data/locale/en/foreman_fog_proxmox.po +401 -0
  88. data/locale/foreman_fog_proxmox.pot +627 -0
  89. data/locale/fr/foreman_fog_proxmox.po +401 -0
  90. data/locale/gemspec.rb +4 -0
  91. data/test/factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb +137 -0
  92. data/test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb +87 -0
  93. data/test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb +134 -0
  94. data/test/factories/proxmox_factory.rb +79 -0
  95. data/test/functional/compute_resources_controller_test.rb +48 -0
  96. data/test/test_plugin_helper.rb +19 -0
  97. data/test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb +204 -0
  98. data/test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb +149 -0
  99. data/test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb +216 -0
  100. data/test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb +124 -0
  101. data/test/unit/foreman_fog_proxmox/proxmox_images_test.rb +52 -0
  102. data/test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb +117 -0
  103. data/test/unit/foreman_fog_proxmox/proxmox_test.rb +58 -0
  104. data/test/unit/foreman_fog_proxmox/proxmox_version_test.rb +94 -0
  105. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb +280 -0
  106. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb +110 -0
  107. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb +222 -0
  108. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_volumes_test.rb +308 -0
  109. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb +43 -0
  110. data/test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb +71 -0
  111. data/test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb +68 -0
  112. data/test/unit/foreman_fog_proxmox/semver_test.rb +111 -0
  113. metadata +249 -0
@@ -0,0 +1,37 @@
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
+ module ForemanFogProxmox
21
+ class Vms
22
+ attr_reader :items
23
+
24
+ def each
25
+ @items.each
26
+ end
27
+
28
+ # TODO: Pagination with filters
29
+ def all(_filters = {})
30
+ items
31
+ end
32
+
33
+ def initialize(items = [])
34
+ @items = items
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,25 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => 'hosts/_compute_detail',
20
+ :name => 'add_from_profile_to_compute_detail',
21
+ :replace => "erb[loud]:contains('provider_partial')",
22
+ :partial => 'compute_resources_vms/form/proxmox/add_from_profile_to_hosts_compute_detail_form',
23
+ :original => '448e3b265e4dc1789f0efbbc6076e32216ac3a24',
24
+ :namespaced => true
25
+ )
@@ -0,0 +1,34 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => 'compute_attributes/_form',
20
+ :name => 'add_from_profile_to_compute_attributes_form',
21
+ :replace => "erb[loud]:contains('render')",
22
+ :partial => 'compute_resources_vms/form/proxmox/add_from_profile_to_compute_attributes_form',
23
+ :original => '0e01b2f93b6855afc207e0e301515cdd300a1c61',
24
+ :namespaced => true
25
+ )
26
+
27
+ Deface::Override.new(
28
+ :virtual_path => 'compute_attributes/_compute_form',
29
+ :name => 'add_from_profile_to_compute_form',
30
+ :replace => "erb[loud]:contains('provider_partial')",
31
+ :partial => 'compute_resources_vms/form/proxmox/add_from_profile_to_compute_form',
32
+ :original => '107f930f8e6b2bdd3e728757d8320d483f19ff9e',
33
+ :namespaced => true
34
+ )
@@ -0,0 +1,25 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => 'compute_resources_vms/new',
20
+ :name => 'add_vm_type_to_networks_form',
21
+ :replace => "erb[loud]:contains('compute_resources_vms/form/networks')",
22
+ :partial => 'compute_resources_vms/form/proxmox/add_vm_type_node_to_new_form',
23
+ :original => '10d73563b7c13f01702aadfffd95956da8bff1ad',
24
+ :namespaced => true
25
+ )
@@ -0,0 +1,34 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => 'compute_resources_vms/form/_networks',
20
+ :name => 'add_vm_type_to_networks_form',
21
+ :replace => "erb[loud]:contains('render')",
22
+ :partial => 'compute_resources_vms/form/proxmox/add_vm_type_to_networks_form',
23
+ :original => 'ce82feb03418d25628001c9fc5f5f78025c5e5f8',
24
+ :namespaced => true
25
+ )
26
+
27
+ Deface::Override.new(
28
+ :virtual_path => 'compute_resources_vms/form/_networks',
29
+ :name => 'add_vm_type_to_networks_new_childs_form',
30
+ :replace => "erb[loud]:contains('new_child_fields_template')",
31
+ :partial => 'compute_resources_vms/form/proxmox/add_vm_type_to_networks_new_childs_form',
32
+ :original => '4ba200e5e02810ade03827374de9b0b8b6a2f6a9',
33
+ :namespaced => true
34
+ )
@@ -0,0 +1,26 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => 'nic/_provider_specific_form',
20
+ :name => 'add_vm_type_to_nic_provider_specific_form',
21
+ :replace => "erb[loud]:contains('f.fields_for')",
22
+ :closing_selector => "erb[silent]:contains('end')",
23
+ :partial => 'compute_resources_vms/form/proxmox/add_vm_type_to_nic_provider_specific_form',
24
+ :original => 'f1a2373efd9c7c993fd1662a2ee4752183542704',
25
+ :namespaced => true
26
+ )
@@ -0,0 +1,25 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => 'compute_resources_vms/form/_volumes',
20
+ :name => 'add_vm_type_to_volumes_edit',
21
+ :replace_contents => 'div.children_fields',
22
+ :partial => 'compute_resources_vms/form/proxmox/add_vm_type_to_volumes_edit',
23
+ :original => '741194531465d567107d762aa11de9d00628c841',
24
+ :namespaced => true
25
+ )
@@ -0,0 +1,25 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => 'compute_resources_vms/form/_volumes',
20
+ :name => 'add_vm_type_to_volumes_new_volume',
21
+ :replace => "erb[silent]:contains('volume = compute_resource.new_volume')",
22
+ :text => '<% if compute_resource.class == ForemanFogProxmox::Proxmox %><% volume = compute_resource.new_volume(type: f.object.type) %><% else %><% volume = compute_resource.new_volume %><% end %>',
23
+ :original => '<% volume = compute_resource.new_volume %>',
24
+ :namespaced => true
25
+ )
@@ -0,0 +1,25 @@
1
+ # Copyright 2018 Tristan Robert
2
+
3
+ # This file is part of ForemanFogProxmox.
4
+
5
+ # ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+
10
+ # ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
+
18
+ Deface::Override.new(
19
+ :virtual_path => 'compute_resources_vms/form/_removable_layout',
20
+ :name => 'remove_new_vm_from_removable_layout',
21
+ :replace_contents => 'div.remove-button',
22
+ :partial => 'compute_resources_vms/form/proxmox/removable_layout',
23
+ :original => '8b7383e57fbe158fc12bf8bc1003431f2f2cb6f5',
24
+ :namespaced => true
25
+ )
@@ -0,0 +1,37 @@
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
+ module ForemanFogProxmox
21
+ module NodeDashboard
22
+ class Data
23
+ def initialize(filter = '')
24
+ @filter = filter
25
+ end
26
+
27
+ def node_id
28
+ @compute_resource = ComputeResource.find_by(type: 'ForemanFogProxmox::Proxmox')
29
+ @compute_resource&.node_id
30
+ end
31
+
32
+ def statistics
33
+ node.statistics('rrddata', timeframe: 'hour', cf: 'AVERAGE') if node_id
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ attributes :url, :user, :password, :ssl_verify_peer, :ssl_certs, :renew
@@ -0,0 +1,29 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <%= javascript_include_tag 'foreman_fog_proxmox/proxmox_compute_resource', "data-turbolinks-track" => true %>
19
+
20
+ <% nodes = f.object.nodes rescue nil %>
21
+ <% token_expired = f.object.token_expired? %>
22
+ <% token_deadline = f.object.token_deadline %>
23
+ <%= checkbox_f f, :renew, :label => _("Renew expired token ?"), :checked_value => '1', :label_help => _("Token expires on #{token_deadline}") %>
24
+ <%= text_f f, :url, :help_block => _("e.g. https://127.0.0.1:8006/api2/json"), :help_inline_permanent => load_button_f(f, !!nodes, _("Test failed")) %>
25
+ <%= text_f f, :user , :help_block => _("e.g. root@pam") %>
26
+ <%= password_f f, :password, :keep_value => true, :unset => unset_password? %>
27
+ <%= checkbox_f f, :ssl_verify_peer, :label => _("SSL verify peer"), :checked_value => '1', :onchange => "sslVerifyPeerSelected()" %>
28
+ <%= textarea_f f, :ssl_certs, :label => _("X509 Certification Authorities"), :size => "col-md-4",
29
+ :placeholder => _("Optionally provide a CA, or a correctly ordered CA chain. If left blank, disable ssl_verify_peer.") %>
@@ -0,0 +1,37 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <tr>
19
+ <td><%= _("URL") %></td>
20
+ <td><%= @compute_resource.url %></td>
21
+ </tr>
22
+ <tr>
23
+ <td><%= _("Version") %></td>
24
+ <td><%= @compute_resource.version%></td>
25
+ </tr>
26
+ <tr>
27
+ <td><%= _("Token has expired?") %></td>
28
+ <td><%= @compute_resource.token_expired?%></td>
29
+ </tr>
30
+ <tr>
31
+ <td><%= _("Token expires on") %></td>
32
+ <td><%= @compute_resource.token_deadline%></td>
33
+ </tr>
34
+ <tr>
35
+ <td><%= _("Cluster nodes") %></td>
36
+ <td><%= @compute_resource.nodes.collect { |node| node.node }%></td>
37
+ </tr>
@@ -0,0 +1,23 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+ <% if @set.compute_resource.class == ForemanFogProxmox::Proxmox %>
18
+ <%= render :partial => "compute_form",
19
+ :locals => { :f => f2, :compute_resource => @set.compute_resource, :selected_cluster => @set.vm_attrs['cluster'], :from_profile => true } %>
20
+ <% else %>
21
+ <%= render :partial => "compute_form",
22
+ :locals => { :f => f2, :compute_resource => @set.compute_resource, :selected_cluster => @set.vm_attrs['cluster'] } %>
23
+ <% end %>
@@ -0,0 +1,23 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+ <% if compute_resource.class == ForemanFogProxmox::Proxmox %>
18
+ <%= render :partial => provider_partial(compute_resource, 'base'),
19
+ :locals => { :f => f, :compute_resource => compute_resource, :new_host => true, :new_vm => true, :hide_image => true, :from_profile => from_profile }.merge(args_for_compute_resource_partial(@host)) %>
20
+ <% else %>
21
+ <%= render :partial => provider_partial(compute_resource, 'base'),
22
+ :locals => { :f => f, :compute_resource => compute_resource, :new_host => true, :new_vm => true, :hide_image => true }.merge(args_for_compute_resource_partial(@host)) %>
23
+ <% end %>
@@ -0,0 +1,24 @@
1
+ <%# Copyright 2018 Tristan Robert
2
+
3
+ This file is part of ForemanFogProxmox.
4
+
5
+ ForemanFogProxmox is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ ForemanFogProxmox is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>. %>
17
+
18
+ <% if compute_resource.class == ForemanFogProxmox::Proxmox %>
19
+ <%= render :partial => provider_partial(compute_resource, 'base'),
20
+ :locals => { :f => f, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm, :from_profile => false }.merge(args_for_compute_resource_partial(@host)) %>
21
+ <% else %>
22
+ <%= render :partial => provider_partial(compute_resource, 'base'),
23
+ :locals => { :f => f, :compute_resource => compute_resource, :new_host => new_vm, :new_vm => new_vm }.merge(args_for_compute_resource_partial(@host)) %>
24
+ <% end %>