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,401 @@
1
+ # French translations for foreman_fog_proxmox package.
2
+ # Copyright (C) 2018 THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the foreman_fog_proxmox package.
4
+ # Tristan Robert <tristan.robert.44@gmail.com>, 2018.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: foreman_fog_proxmox 1.0.0\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "PO-Revision-Date: 2018-07-17 15:16+0200\n"
11
+ "Last-Translator: Tristan Robert <tristan.robert.44@gmail.com>\n"
12
+ "Language-Team: French\n"
13
+ "Language: fr\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=2; plural=n>1;\n"
18
+ "\n"
19
+
20
+ msgid "%<s>s console is not supported at this time"
21
+ msgstr ""
22
+
23
+ msgid "Add Volume"
24
+ msgstr "Ajouter un volume"
25
+
26
+ msgid "Advanced"
27
+ msgstr "Avancé"
28
+
29
+ msgid "Architecture"
30
+ msgstr ""
31
+
32
+ msgid "Average load (x100)"
33
+ msgstr "Charge moyenne du serveur (x100)"
34
+
35
+ msgid "Boot device order"
36
+ msgstr ""
37
+
38
+ msgid "Bridge"
39
+ msgstr "Pont"
40
+
41
+ msgid "CD-ROM"
42
+ msgstr ""
43
+
44
+ msgid "CDROM"
45
+ msgstr ""
46
+
47
+ msgid "CIDR IPv4 prefix"
48
+ msgstr ""
49
+
50
+ msgid "CIDR IPv6 prefix"
51
+ msgstr ""
52
+
53
+ msgid "CPU"
54
+ msgstr ""
55
+
56
+ msgid "CPU limit"
57
+ msgstr "Limite CPU"
58
+
59
+ msgid "CPU units"
60
+ msgstr "Unités CPU"
61
+
62
+ msgid "CPUs"
63
+ msgstr ""
64
+
65
+ msgid "Cache"
66
+ msgstr ""
67
+
68
+ msgid "Card"
69
+ msgstr "Carte"
70
+
71
+ msgid "Change the password"
72
+ msgstr "Changer le mot de passe"
73
+
74
+ msgid "Cluster nodes"
75
+ msgstr "Noeuds de la ferme"
76
+
77
+ msgid "Controller"
78
+ msgstr "Contrôleur"
79
+
80
+ msgid "Cores"
81
+ msgstr "Coeurs"
82
+
83
+ msgid "Create image?"
84
+ msgstr "Créer image?"
85
+
86
+ msgid "DHCP IPv4"
87
+ msgstr ""
88
+
89
+ msgid "DHCP IPv6"
90
+ msgstr ""
91
+
92
+ msgid "DNS"
93
+ msgstr ""
94
+
95
+ msgid "DNS server"
96
+ msgstr ""
97
+
98
+ msgid "Description"
99
+ msgstr ""
100
+
101
+ msgid "Device"
102
+ msgstr "Périphérque"
103
+
104
+ msgid "Disconnect"
105
+ msgstr "Se déconnecter"
106
+
107
+ msgid "Disk"
108
+ msgstr "Disque"
109
+
110
+ msgid "Does this image support user data input (e.g. via cloud-init)?"
111
+ msgstr "Cette immage gère-t-elle les données utilisateurs (par exemple via cloud-init)?"
112
+
113
+ msgid "Enable NUMA"
114
+ msgstr "Activer NUMA"
115
+
116
+ msgid "Enable/disable KVM hardware virtualization"
117
+ msgstr "Activer/désactiver la virtualisation matérielle de KVM"
118
+
119
+ msgid "Extended"
120
+ msgstr "Etendu"
121
+
122
+ msgid "Failed retrieving proxmox compute client caused by %<e>s"
123
+ msgstr ""
124
+
125
+ msgid "Failed retrieving proxmox identity client caused by %<e>s"
126
+ msgstr ""
127
+
128
+ msgid "Failed retrieving proxmox network client caused by %<e>s"
129
+ msgstr ""
130
+
131
+ msgid "Failed retrieving proxmox server vm by vmid=%<vmid>s"
132
+ msgstr ""
133
+
134
+ msgid "Failed to undo update compute %<compute_resource>s instance %<name>s: %<e>s"
135
+ msgstr ""
136
+
137
+ msgid "Failed to update a compute %<compute_resource>s instance %<name>s: %<e>s"
138
+ msgstr ""
139
+
140
+ msgid "Firewall"
141
+ msgstr "Pare-feu"
142
+
143
+ msgid "Floppy disk (a), hard disk (c), cdrom (d), network (n). Default cdn"
144
+ msgstr ""
145
+
146
+ msgid "Foreman Fog Proxmox widget"
147
+ msgstr ""
148
+
149
+ msgid "ForemanFogProxmox plugin adds Proxmox VE compute resource to Foreman using fog-proxmox gem."
150
+ msgstr "Le plugin ForemanFogProxmox ajoute la ressource de calcul Proxmox VE à foreman en utilisant le gem fog-proxmox"
151
+
152
+ msgid "Gateway IPv4"
153
+ msgstr ""
154
+
155
+ msgid "Gateway IPv6"
156
+ msgstr ""
157
+
158
+ msgid "General"
159
+ msgstr "Général"
160
+
161
+ msgid "Hostname"
162
+ msgstr "Nom d'hôte"
163
+
164
+ msgid "Image"
165
+ msgstr ""
166
+
167
+ msgid "Image ISO"
168
+ msgstr ""
169
+
170
+ msgid "Image VMID"
171
+ msgstr ""
172
+
173
+ msgid "KVM"
174
+ msgstr ""
175
+
176
+ msgid "Keyboard"
177
+ msgstr "Clavier"
178
+
179
+ msgid "Main option"
180
+ msgid_plural "Main options"
181
+ msgstr[0] "Option principale"
182
+ msgstr[1] "Options principales"
183
+
184
+ msgid "Memory"
185
+ msgstr "Mémoire"
186
+
187
+ msgid "Minimum memory"
188
+ msgstr "Mémoire minimale"
189
+
190
+ msgid "Mount point"
191
+ msgstr "Point de montage"
192
+
193
+ msgid "Multiqueue"
194
+ msgstr ""
195
+
196
+ msgid "Name"
197
+ msgstr "Nom"
198
+
199
+ msgid "Nic"
200
+ msgstr ""
201
+
202
+ msgid "Node"
203
+ msgstr "Noeud"
204
+
205
+ msgid "None"
206
+ msgstr "Aucun"
207
+
208
+ msgid "OS"
209
+ msgstr "Système d'exploitation"
210
+
211
+ msgid "OS Template"
212
+ msgstr "Modèle d'OS"
213
+
214
+ msgid "OS type"
215
+ msgstr "Type de système d'exploitation"
216
+
217
+ msgid "Operating System"
218
+ msgstr "Système d'exploitation"
219
+
220
+ msgid "Operating system family %<type>s is not consistent with %<ostype>s"
221
+ msgstr ""
222
+
223
+ msgid "Optionally provide a CA, or a correctly ordered CA chain. If left blank, disable ssl_verify_peer."
224
+ msgstr "Vous pouvez éventuellement fournir un certificat ou une chaîne de certificats. Si non renseigné, alors désactivez ssl_verify_peer."
225
+
226
+ msgid "PCID"
227
+ msgstr ""
228
+
229
+ msgid "Password to authenticate with - used for SSH finish step."
230
+ msgstr "Mot de passe d'authentification - utilisé dans la dernière phase avec SSH."
231
+
232
+ msgid "Path"
233
+ msgstr "Chemin"
234
+
235
+ msgid "Physical"
236
+ msgstr "Physique"
237
+
238
+ msgid "Pool"
239
+ msgstr ""
240
+
241
+ msgid "Power"
242
+ msgstr "Alimentation"
243
+
244
+ msgid "Proxmox Node Statistics: %s"
245
+ msgstr "Statistiques du noeud Proxmox: %s"
246
+
247
+ msgid "Proxmox compute resource version is %<version>s"
248
+ msgstr ""
249
+
250
+ msgid "Proxmox version %<version>s is not semver suitable"
251
+ msgstr ""
252
+
253
+ msgid "Qemu Agent"
254
+ msgstr "Agent Qemu"
255
+
256
+ msgid "Rate limit"
257
+ msgstr "Taux limite"
258
+
259
+ msgid "Renew expired token ?"
260
+ msgstr "Renouveler jeton expiré?"
261
+
262
+ msgid "Root password"
263
+ msgstr "Mot de passe root"
264
+
265
+ msgid "Rootfs"
266
+ msgstr ""
267
+
268
+ msgid "SCSI Controller"
269
+ msgstr ""
270
+
271
+ msgid "SSL verify peer"
272
+ msgstr ""
273
+
274
+ msgid "Search domain"
275
+ msgstr "Domaine de recherche"
276
+
277
+ msgid "Shares"
278
+ msgstr "Partages"
279
+
280
+ msgid "Size"
281
+ msgstr "Taille"
282
+
283
+ msgid "Sockets"
284
+ msgstr ""
285
+
286
+ msgid "Spectre-CTRL"
287
+ msgstr ""
288
+
289
+ msgid "Start after creation?"
290
+ msgstr "Démarrer après création?"
291
+
292
+ msgid "Start at boot"
293
+ msgstr "Démarrer au boot"
294
+
295
+ msgid "Storage"
296
+ msgstr "Stockage"
297
+
298
+ msgid "Swap"
299
+ msgstr ""
300
+
301
+ msgid "Template storage"
302
+ msgstr "Modèle de stockage"
303
+
304
+ msgid "Test failed"
305
+ msgstr "Le test a échoué"
306
+
307
+ msgid "The user that is used to ssh into the instance, normally cloud-user, ubuntu, root etc"
308
+ msgstr "Le compte utilisé pour SSH, en général compte cloud, ubuntu ou root, etc"
309
+
310
+ msgid "Time"
311
+ msgstr "Temps"
312
+
313
+ msgid "Token expires on"
314
+ msgstr "Jeton expire le "
315
+
316
+ msgid "Token has expired?"
317
+ msgstr "Jeton expiré?"
318
+
319
+ msgid "Type"
320
+ msgstr ""
321
+
322
+ msgid "URL"
323
+ msgstr ""
324
+
325
+ msgid "Unable to shrink %<id>s size. Proxmox allows only increasing size."
326
+ msgstr ""
327
+
328
+ msgid "Unable to store X509 certificates"
329
+ msgstr "Impossible d'enregistrer les certificats X509"
330
+
331
+ msgid "Uptime"
332
+ msgstr "En marche depuis (s)"
333
+
334
+ msgid "VCPUs"
335
+ msgstr ""
336
+
337
+ msgid "VGA"
338
+ msgstr ""
339
+
340
+ msgid "VLAN tag"
341
+ msgstr "Etiquette VLAN"
342
+
343
+ msgid "VM ID"
344
+ msgstr ""
345
+
346
+ msgid "Version"
347
+ msgstr ""
348
+
349
+ msgid "X509 Certification Authorities"
350
+ msgstr "Autorités de certification X509"
351
+
352
+ msgid "add new storage volume"
353
+ msgstr "ajouter un nouveau volume de stockage"
354
+
355
+ msgid "add_vm_to_pool(%<poolid>s, %<vmid>s)"
356
+ msgstr ""
357
+
358
+ msgid "create_vm(): clone %<image_id>s in %<vmid>s"
359
+ msgstr ""
360
+
361
+ msgid "e.g. /path/to/"
362
+ msgstr ""
363
+
364
+ msgid "e.g. https://127.0.0.1:8006/api2/json"
365
+ msgstr "par exemple https://127.0.0.1:8006/api2/json"
366
+
367
+ msgid "e.g. root@pam"
368
+ msgstr "par exemple root@pam"
369
+
370
+ msgid "failed to create vm: %<e>s"
371
+ msgstr "échec à la création de la VM: %<e>s"
372
+
373
+ msgid "found vm: %<vmid>s member of pool: %<poolid>s"
374
+ msgstr ""
375
+
376
+ msgid "invalid vmid=%<vmid>s"
377
+ msgstr "vmid=%<vmid>s incorrect"
378
+
379
+ msgid "new_container_vm() vm.config=%<config>s"
380
+ msgstr ""
381
+
382
+ msgid "new_server_vm() vm.config=%<config>s"
383
+ msgstr ""
384
+
385
+ msgid "new_vm() vm.config=%<config>s"
386
+ msgstr ""
387
+
388
+ msgid "pool_owner(%<vmid>s)"
389
+ msgstr ""
390
+
391
+ msgid "remove network interface"
392
+ msgstr "retirer l'interface réseau"
393
+
394
+ msgid "remove storage volume"
395
+ msgstr "retirer le stockage de volume"
396
+
397
+ msgid "remove_vm_from_pool(%<poolid>s, %<vmid>s)"
398
+ msgstr ""
399
+
400
+ msgid "vmid of template vm."
401
+ msgstr "vmid de la VM modèle."
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Matches foreman_fog_proxmox.gemspec
4
+ _('ForemanFogProxmox plugin adds Proxmox VE compute resource to Foreman using fog-proxmox gem.')
@@ -0,0 +1,137 @@
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 ProxmoxContainerMockFactory
22
+ def mock_container_vm
23
+ interface_attributes = {
24
+ id: 'net0',
25
+ mac: '36:25:8C:53:0C:50',
26
+ model: nil,
27
+ name: 'eth0',
28
+ ip: nil,
29
+ ip6: nil,
30
+ bridge: 'vmbr0',
31
+ firewall: nil,
32
+ link_down: nil,
33
+ rate: nil,
34
+ queues: nil,
35
+ tag: nil
36
+ }
37
+ interface = mock('interface')
38
+ interface.stubs(:attributes).returns(interface_attributes)
39
+ interfaces = [interface]
40
+ volume_attributes = {
41
+ id: 'rootfs',
42
+ volid: 'local-lvm:vm-100-disk-1',
43
+ size: 8,
44
+ storage: 'local-lvm',
45
+ cache: 'none',
46
+ replicate: nil,
47
+ media: nil,
48
+ format: nil,
49
+ model: 'rootfs',
50
+ shared: nil,
51
+ snapshot: nil,
52
+ backup: nil,
53
+ aio: nil
54
+ }
55
+ volume = mock('volume')
56
+ volume.stubs(:attributes).returns(volume_attributes)
57
+ volumes = [volume]
58
+ config = mock('config')
59
+ config_attributes = {
60
+ vmid: 100,
61
+ digest: '0',
62
+ ostype: 'alpine',
63
+ storage: 'local-lvm',
64
+ template: 0,
65
+ arch: 'amd64',
66
+ memory: 512,
67
+ swap: nil,
68
+ hostname: 'test',
69
+ nameserver: nil,
70
+ searchdomain: nil,
71
+ password: 'proxmox01',
72
+ onboot: 0,
73
+ startup: nil,
74
+ cores: 1,
75
+ cpuunits: nil,
76
+ cpulimit: nil,
77
+ description: nil,
78
+ console: nil,
79
+ cmode: nil,
80
+ tty: nil,
81
+ force: nil,
82
+ lock: nil,
83
+ pool: nil,
84
+ bwlimit: nil,
85
+ unprivileged: nil,
86
+ interfaces: interfaces,
87
+ disks: volumes
88
+ }
89
+ config.stubs(:attributes).returns(config_attributes)
90
+ config.stubs(:attributes).returns(config_attributes)
91
+ config.stubs(:disks).returns(volumes)
92
+ config.stubs(:interfaces).returns(interfaces)
93
+ config.stubs(:respond_to?).returns(true)
94
+ vm = mock('vm')
95
+ vm.stubs(:respond_to?).returns(true)
96
+ vm.stubs(:config).returns(config)
97
+ vm.stubs(:type).returns('lxc')
98
+ vm.stubs(:identity).returns(100)
99
+ vm.stubs(:node_id).returns('pve')
100
+ vm.stubs(:identity).returns(100)
101
+ service = mock('service')
102
+ vm_attributes = {
103
+ vmid: 100,
104
+ id: 'lxc/100',
105
+ node_id: 'pve',
106
+ service: service,
107
+ config: config,
108
+ name: 'test',
109
+ type: 'lxc',
110
+ maxdisk: 0,
111
+ disk: 0,
112
+ diskwrite: 0,
113
+ diskread: 0,
114
+ uptime: 0,
115
+ netout: 0,
116
+ netin: 0,
117
+ cpu: 1,
118
+ cpus: 1,
119
+ template: 0,
120
+ status: 'stopped',
121
+ maxcpu: 0,
122
+ mem: 0,
123
+ maxmem: 512,
124
+ qmpstatus: 'stopped',
125
+ ha: {},
126
+ pid: 0,
127
+ blockstat: 0,
128
+ balloon: 0,
129
+ ballooninfo: 0,
130
+ snapshots: []
131
+ }
132
+ vm.stubs(:attributes).returns(vm_attributes)
133
+ vm.stubs(:container?).returns(true)
134
+ [vm, config_attributes, volume_attributes, interface_attributes]
135
+ end
136
+ end
137
+ end