foreman_fog_proxmox 0.8.0 → 0.8.2

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 (93) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -1
  3. data/Rakefile +3 -1
  4. data/app/controllers/concerns/foreman_fog_proxmox/controller/parameters/compute_resource.rb +2 -2
  5. data/app/controllers/foreman_fog_proxmox/compute_resources_controller.rb +2 -2
  6. data/app/helpers/node_dashboard_helper.rb +13 -14
  7. data/app/helpers/proxmox_compute_selectors_helper.rb +49 -50
  8. data/app/helpers/proxmox_container_helper.rb +42 -36
  9. data/app/helpers/proxmox_form_helper.rb +38 -40
  10. data/app/helpers/proxmox_server_helper.rb +39 -41
  11. data/app/helpers/proxmox_vm_helper.rb +21 -25
  12. data/app/models/concerns/fog_extensions/proxmox/disk.rb +8 -8
  13. data/app/models/concerns/fog_extensions/proxmox/interface.rb +8 -8
  14. data/app/models/concerns/fog_extensions/proxmox/node.rb +24 -22
  15. data/app/models/concerns/fog_extensions/proxmox/server.rb +71 -59
  16. data/app/models/concerns/fog_extensions/proxmox/server_config.rb +47 -39
  17. data/app/models/concerns/fog_extensions/proxmox/volume.rb +8 -8
  18. data/app/models/concerns/host_ext/proxmox/interfaces.rb +21 -13
  19. data/app/models/concerns/orchestration/proxmox/compute.rb +14 -10
  20. data/app/models/foreman_fog_proxmox/options_select.rb +14 -14
  21. data/app/models/foreman_fog_proxmox/proxmox.rb +30 -466
  22. data/app/models/foreman_fog_proxmox/proxmox_compute_attributes.rb +54 -0
  23. data/app/models/foreman_fog_proxmox/proxmox_connection.rb +67 -0
  24. data/app/models/foreman_fog_proxmox/proxmox_console.rb +41 -0
  25. data/app/models/foreman_fog_proxmox/proxmox_images.rb +53 -0
  26. data/app/models/foreman_fog_proxmox/proxmox_interfaces.rb +60 -0
  27. data/app/models/foreman_fog_proxmox/proxmox_operating_systems.rb +49 -0
  28. data/app/models/foreman_fog_proxmox/proxmox_token_expiration.rb +30 -0
  29. data/app/models/foreman_fog_proxmox/proxmox_version.rb +36 -0
  30. data/app/models/foreman_fog_proxmox/proxmox_vm_commands.rb +108 -0
  31. data/app/models/foreman_fog_proxmox/proxmox_vm_new.rb +162 -0
  32. data/app/models/foreman_fog_proxmox/proxmox_vm_queries.rb +74 -0
  33. data/app/models/foreman_fog_proxmox/proxmox_volumes.rb +85 -0
  34. data/app/overrides/compute_resources_vms/form/add_clone_to_new_vm_compute_detail.rb +7 -6
  35. data/app/overrides/compute_resources_vms/form/add_from_profile_to_compute_attributes_form.rb +13 -11
  36. data/app/overrides/compute_resources_vms/form/add_vm_type_to_networks_form.rb +13 -11
  37. data/app/overrides/compute_resources_vms/form/add_vm_type_to_nic_provider_specific_form.rb +8 -7
  38. data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_edit.rb +7 -6
  39. data/app/overrides/compute_resources_vms/form/add_vm_type_to_volumes_new_volume.rb +7 -6
  40. data/app/overrides/compute_resources_vms/form/remove_new_vm_from_removable_layout.rb +7 -6
  41. data/app/services/foreman_fog_proxmox/node_dashboard/data.rb +16 -16
  42. data/app/views/api/v2/compute_resources/proxmox.json.rabl +3 -1
  43. data/app/views/compute_resources/form/_proxmox.html.erb +3 -0
  44. data/app/views/compute_resources/show/_proxmox.html.erb +8 -0
  45. data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_attributes_form.html.erb +5 -0
  46. data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_compute_form.html.erb +6 -1
  47. data/app/views/compute_resources_vms/form/proxmox/_add_from_profile_to_hosts_compute_detail_form.html.erb +6 -0
  48. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_form.html.erb +6 -2
  49. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_networks_new_childs_form.html.erb +8 -2
  50. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_nic_provider_specific_form.html.erb +6 -0
  51. data/app/views/compute_resources_vms/form/proxmox/_add_vm_type_to_volumes_edit.html.erb +15 -1
  52. data/app/views/compute_resources_vms/form/proxmox/_base.html.erb +2 -2
  53. data/app/views/compute_resources_vms/form/proxmox/_general.html.erb +1 -1
  54. data/app/views/compute_resources_vms/form/proxmox/_removable_layout.html.erb +6 -1
  55. data/app/views/compute_resources_vms/form/proxmox/container/_extended.html.erb +1 -1
  56. data/app/views/compute_resources_vms/form/proxmox/container/_volume_mp.html.erb +1 -1
  57. data/app/views/compute_resources_vms/form/proxmox/server/_config.html.erb +1 -1
  58. data/app/views/compute_resources_vms/form/proxmox/server/_volume.html.erb +2 -2
  59. data/config/routes.rb +4 -4
  60. data/lib/foreman_fog_proxmox/engine.rb +14 -14
  61. data/lib/foreman_fog_proxmox/semver.rb +78 -78
  62. data/lib/foreman_fog_proxmox/value.rb +5 -3
  63. data/lib/foreman_fog_proxmox/version.rb +1 -1
  64. data/lib/tasks/foreman_fog_proxmox_tasks.rake +3 -13
  65. data/locale/en/foreman_fog_proxmox.edit.po +472 -0
  66. data/locale/en/foreman_fog_proxmox.po +48 -24
  67. data/locale/en/foreman_fog_proxmox.po.time_stamp +0 -0
  68. data/locale/foreman_fog_proxmox.pot +140 -102
  69. data/locale/fr/foreman_fog_proxmox.edit.po +472 -0
  70. data/locale/fr/foreman_fog_proxmox.po +52 -28
  71. data/locale/fr/foreman_fog_proxmox.po.time_stamp +0 -0
  72. data/locale/gemspec.rb +2 -0
  73. data/test/{unit/foreman_fog_proxmox/proxmox_test_helpers.rb → factories/foreman_fog_proxmox/proxmox_container_mock_factory.rb} +4 -140
  74. data/test/factories/foreman_fog_proxmox/proxmox_node_mock_factory.rb +61 -0
  75. data/test/factories/foreman_fog_proxmox/proxmox_server_mock_factory.rb +134 -0
  76. data/test/factories/proxmox_factory.rb +15 -15
  77. data/test/functional/compute_resources_controller_test.rb +12 -10
  78. data/test/test_plugin_helper.rb +2 -0
  79. data/test/unit/foreman_fog_proxmox/helpers/proxmox_container_helper_test.rb +178 -182
  80. data/test/unit/foreman_fog_proxmox/helpers/proxmox_server_helper_test.rb +122 -126
  81. data/test/unit/foreman_fog_proxmox/helpers/proxmox_vm_helper_test.rb +180 -187
  82. data/test/unit/foreman_fog_proxmox/proxmox_compute_attributes_test.rb +116 -0
  83. data/test/unit/foreman_fog_proxmox/proxmox_interfaces_test.rb +71 -0
  84. data/test/unit/foreman_fog_proxmox/proxmox_test.rb +9 -479
  85. data/test/unit/foreman_fog_proxmox/proxmox_version_test.rb +82 -0
  86. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_container_test.rb +207 -0
  87. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_create_test.rb +92 -0
  88. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_server_update_test.rb +324 -0
  89. data/test/unit/foreman_fog_proxmox/proxmox_vm_commands_test.rb +43 -0
  90. data/test/unit/foreman_fog_proxmox/proxmox_vm_new_test.rb +71 -0
  91. data/test/unit/foreman_fog_proxmox/proxmox_vm_queries_test.rb +63 -0
  92. data/test/unit/foreman_fog_proxmox/semver_test.rb +67 -53
  93. metadata +52 -14
@@ -0,0 +1,162 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2019 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 'fog/proxmox'
21
+ require 'fog/proxmox/helpers/nic_helper'
22
+ require 'fog/proxmox/helpers/disk_helper'
23
+
24
+ module ForemanFogProxmox
25
+ module ProxmoxVmNew
26
+ include ProxmoxVmHelper
27
+
28
+ def volume_server_defaults(controller = 'scsi', device = 0)
29
+ id = "#{controller}#{device}"
30
+ { id: id, storage: storages.first.identity.to_s, size: (8 * GIGA), options: { cache: 'none' } }
31
+ end
32
+
33
+ def volume_container_defaults(id = 'rootfs')
34
+ { id: id, storage: storages.first.identity.to_s, size: (8 * GIGA), options: {} }
35
+ end
36
+
37
+ def new_volume(attr = {})
38
+ type = attr['type']
39
+ type ||= 'qemu'
40
+ case type
41
+ when 'lxc'
42
+ return new_volume_server(attr)
43
+ when 'qemu'
44
+ return new_volume_container(attr)
45
+ end
46
+ end
47
+
48
+ def new_volume_server(attr = {})
49
+ opts = volume_server_defaults.merge(attr.to_h).deep_symbolize_keys
50
+ opts[:size] = opts[:size].to_s
51
+ Fog::Proxmox::Compute::Disk.new(opts)
52
+ end
53
+
54
+ def new_volume_container(attr = {})
55
+ opts = volume_container_defaults.merge(attr.to_h).deep_symbolize_keys
56
+ opts[:size] = opts[:size].to_s
57
+ Fog::Proxmox::Compute::Disk.new(opts)
58
+ end
59
+
60
+ def interface_defaults(id = 'net0')
61
+ { id: id, model: 'virtio', name: 'eth0', bridge: bridges.first.identity.to_s }
62
+ end
63
+
64
+ def interface_server_defaults(id = 'net0')
65
+ { id: id, model: 'virtio', bridge: bridges.first.identity.to_s }
66
+ end
67
+
68
+ def interface_container_defaults(id = 'net0')
69
+ { id: id, name: 'eth0', bridge: bridges.first.identity.to_s }
70
+ end
71
+
72
+ def new_interface(attr = {})
73
+ type = attr['type']
74
+ type ||= 'qemu'
75
+ case type
76
+ when 'lxc'
77
+ return new_container_interface(attr)
78
+ when 'qemu'
79
+ return new_server_interface(attr)
80
+ end
81
+ end
82
+
83
+ def new_server_interface(attr = {})
84
+ logger.debug('new_server_interface')
85
+ opts = interface_server_defaults.merge(attr.to_h).deep_symbolize_keys
86
+ Fog::Proxmox::Compute::Interface.new(opts)
87
+ end
88
+
89
+ def new_container_interface(attr = {})
90
+ logger.debug('new_container_interface')
91
+ opts = interface_container_defaults.merge(attr.to_h).deep_symbolize_keys
92
+ Fog::Proxmox::Compute::Interface.new(opts)
93
+ end
94
+
95
+ def vm_server_instance_defaults
96
+ ActiveSupport::HashWithIndifferentAccess.new(
97
+ name: "foreman_#{Time.now.to_i}",
98
+ vmid: next_vmid,
99
+ type: 'qemu',
100
+ node_id: node_id,
101
+ cores: 1,
102
+ sockets: 1,
103
+ kvm: 1,
104
+ vga: 'std',
105
+ memory: 512 * MEGA,
106
+ ostype: 'l26',
107
+ keyboard: 'en-us',
108
+ cpu: 'kvm64',
109
+ scsihw: 'virtio-scsi-pci',
110
+ ide2: 'none,media=cdrom',
111
+ templated: 0
112
+ ).merge(Fog::Proxmox::DiskHelper.flatten(volume_server_defaults)).merge(Fog::Proxmox::DiskHelper.flatten(volume_container_defaults)).merge(Fog::Proxmox::NicHelper.flatten(interface_defaults))
113
+ end
114
+
115
+ def vm_container_instance_defaults
116
+ ActiveSupport::HashWithIndifferentAccess.new(
117
+ name: "foreman_#{Time.now.to_i}",
118
+ vmid: next_vmid,
119
+ type: 'lxc',
120
+ node_id: node_id,
121
+ memory: 512 * MEGA,
122
+ templated: 0
123
+ ).merge(Fog::Proxmox::DiskHelper.flatten(volume_container_defaults)).merge(Fog::Proxmox::DiskHelper.flatten(volume_server_defaults)).merge(Fog::Proxmox::NicHelper.flatten(interface_defaults))
124
+ end
125
+
126
+ def vm_instance_defaults
127
+ super.merge(vmid: next_vmid, node_id: node_id)
128
+ end
129
+
130
+ def new_vm(new_attr = {})
131
+ new_attr = ActiveSupport::HashWithIndifferentAccess.new(new_attr)
132
+ type = new_attr['type']
133
+ type ||= 'qemu'
134
+ case type
135
+ when 'lxc'
136
+ vm = new_container_vm(new_attr)
137
+ when 'qemu'
138
+ vm = new_server_vm(new_attr)
139
+ end
140
+ logger.debug(format(_('new_vm() vm.config=%<config>s'), config: vm.config.inspect))
141
+ vm
142
+ end
143
+
144
+ def new_container_vm(new_attr = {})
145
+ options = new_attr
146
+ options = options.merge(node_id: node_id).merge(type: 'lxc').merge(vmid: next_vmid)
147
+ options = vm_container_instance_defaults.merge(options) if new_attr.empty?
148
+ vm = node.containers.new(parse_container_vm(options).deep_symbolize_keys)
149
+ logger.debug(format(_('new_container_vm() vm.config=%<config>s'), config: vm.config.inspect))
150
+ vm
151
+ end
152
+
153
+ def new_server_vm(new_attr = {})
154
+ options = new_attr
155
+ options = options.merge(node_id: node_id).merge(type: 'qemu').merge(vmid: next_vmid)
156
+ options = vm_server_instance_defaults.merge(options) if new_attr.empty?
157
+ vm = node.servers.new(parse_server_vm(options).deep_symbolize_keys)
158
+ logger.debug(format(_('new_server_vm() vm.config=%<config>s'), config: vm.config.inspect))
159
+ vm
160
+ end
161
+ end
162
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2019 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 ProxmoxVmQueries
22
+ def next_vmid
23
+ node.servers.next_id
24
+ end
25
+
26
+ def nodes
27
+ nodes = client.nodes.all if client
28
+ nodes&.sort_by(&:node)
29
+ end
30
+
31
+ def pools
32
+ pools = identity_client.pools.all
33
+ pools.sort_by(&:poolid)
34
+ end
35
+
36
+ def storages(type = 'images')
37
+ storages = node.storages.list_by_content_type type
38
+ storages.sort_by(&:storage)
39
+ end
40
+
41
+ def bridges
42
+ node = network_client.nodes.get node_id
43
+ bridges = node.networks.all(type: 'any_bridge')
44
+ bridges.sort_by(&:iface)
45
+ end
46
+
47
+ def vms(_opts = {})
48
+ node
49
+ end
50
+
51
+ def find_vm_by_uuid(uuid)
52
+ # look for the uuid on all known nodes
53
+ vm = nil
54
+ nodes.each do |node|
55
+ vm = find_vm_in_servers_by_uuid(node.servers, uuid)
56
+ vm ||= find_vm_in_servers_by_uuid(node.containers, uuid)
57
+ unless vm.nil?
58
+ logger.debug("found vm #{uuid} on node #{node.node}")
59
+ break
60
+ end
61
+ end
62
+ vm
63
+ end
64
+
65
+ def find_vm_in_servers_by_uuid(servers, uuid)
66
+ servers.get(uuid)
67
+ rescue Fog::Errors::NotFound
68
+ nil
69
+ rescue StandardError => e
70
+ Foreman::Logging.exception(format(_('Failed retrieving proxmox server vm by vmid=%<vmid>s'), vmid: uuid), e)
71
+ raise(ActiveRecord::RecordNotFound)
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2019 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 'fog/proxmox/helpers/disk_helper'
21
+
22
+ module ForemanFogProxmox
23
+ module ProxmoxVolumes
24
+ include ProxmoxVmHelper
25
+
26
+ def delete_volume(vm, id)
27
+ vm.detach(id)
28
+ device = Fog::Proxmox::DiskHelper.extract_device(id)
29
+ vm.detach('unused' + device.to_s)
30
+ end
31
+
32
+ def extend_or_move_volume(vm, id, volume_attributes)
33
+ disk = vm.config.disks.get(id)
34
+ diff_size = volume_attributes['size'].to_i - disk.size
35
+ raise ::Foreman::Exception, format(_('Unable to shrink %<id>s size. Proxmox allows only increasing size.'), id: id) unless diff_size >= 0
36
+
37
+ if diff_size > 0
38
+ extension = '+' + (diff_size / GIGA).to_s + 'G'
39
+ vm.extend(id, extension)
40
+ elsif disk.storage != volume_attributes['storage']
41
+ vm.move(id, volume_attributes['storage'])
42
+ end
43
+ end
44
+
45
+ def volume_exists?(volume_attributes)
46
+ volid = volume_attributes.key?('volid') ? volume_attributes['volid'] : ''
47
+ volid.present?
48
+ end
49
+
50
+ def volume_to_delete?(volume_attributes)
51
+ volume_attributes['_delete'].blank? ? false : Foreman::Cast.to_bool(volume_attributes['_delete'])
52
+ end
53
+
54
+ def extract_id(vm, volume_attributes)
55
+ id = ''
56
+ if volume_exists?(volume_attributes)
57
+ id = volume_attributes['id']
58
+ else
59
+ device = vm.container? ? 'mp' : volume_attributes['controller']
60
+ id = device + volume_attributes['device']
61
+ end
62
+ id
63
+ end
64
+
65
+ def add_volume(vm, id, volume_attributes)
66
+ options = {}
67
+ options.store(:mp, volume_attributes['mp']) if vm.container?
68
+ disk_attributes = { id: id, storage: volume_attributes['storage'], size: (volume_attributes['size'].to_i / GIGA).to_s }
69
+ vm.attach(disk_attributes, options)
70
+ end
71
+
72
+ def save_volume(vm, volume_attributes)
73
+ id = extract_id(vm, volume_attributes)
74
+ if volume_exists?(volume_attributes)
75
+ if volume_to_delete?(volume_attributes)
76
+ delete_volume(vm, id)
77
+ else
78
+ extend_or_move_volume(vm, id, volume_attributes)
79
+ end
80
+ else
81
+ add_volume(vm, id, volume_attributes)
82
+ end
83
+ end
84
+ end
85
+ end
@@ -16,9 +16,10 @@
16
16
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
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
- )
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
+ )
@@ -16,17 +16,19 @@
16
16
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
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'
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
24
25
  )
25
26
 
26
27
  Deface::Override.new(
27
- :virtual_path => "compute_attributes/_compute_form",
28
- :name => "add_from_profile_to_compute_form",
29
- :replace => "erb[loud]:contains('provider_partial')",
30
- :partial => "compute_resources_vms/form/proxmox/add_from_profile_to_compute_form",
31
- :original => '107f930f8e6b2bdd3e728757d8320d483f19ff9e'
32
- )
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
+ )
@@ -16,17 +16,19 @@
16
16
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
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'
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
24
25
  )
25
26
 
26
27
  Deface::Override.new(
27
- :virtual_path => "compute_resources_vms/form/_networks",
28
- :name => "add_vm_type_to_networks_new_childs_form",
29
- :replace => "erb[loud]:contains('new_child_fields_template')",
30
- :partial => "compute_resources_vms/form/proxmox/add_vm_type_to_networks_new_childs_form",
31
- :original => '4ba200e5e02810ade03827374de9b0b8b6a2f6a9'
32
- )
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
+ )
@@ -16,10 +16,11 @@
16
16
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
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
- )
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
+ )
@@ -16,9 +16,10 @@
16
16
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
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
- )
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
+ )
@@ -16,9 +16,10 @@
16
16
  # along with ForemanFogProxmox. If not, see <http://www.gnu.org/licenses/>.
17
17
 
18
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 => "<% volume = compute_resource.new_volume(type: f.object.type) %>",
23
- :original => "<% volume = compute_resource.new_volume %>"
24
- )
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
+ )