fog-proxmox 0.5.5 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/.gitlab-ci.yml +7 -0
  3. data/.travis.yml +1 -0
  4. data/.vscode/launch.json +3 -21
  5. data/.vscode/settings.json +7 -7
  6. data/Gemfile.lock +39 -39
  7. data/README.md +9 -2
  8. data/examples/compute.rb +20 -23
  9. data/examples/identity.rb +16 -21
  10. data/fog-proxmox.gemspec +1 -2
  11. data/lib/fog/compute/proxmox.rb +2 -8
  12. data/lib/fog/compute/proxmox/models/disk.rb +13 -11
  13. data/lib/fog/compute/proxmox/models/disks.rb +3 -5
  14. data/lib/fog/compute/proxmox/models/interface.rb +6 -11
  15. data/lib/fog/compute/proxmox/models/interfaces.rb +3 -5
  16. data/lib/fog/compute/proxmox/models/node.rb +38 -43
  17. data/lib/fog/compute/proxmox/models/nodes.rb +5 -11
  18. data/lib/fog/compute/proxmox/models/server.rb +123 -80
  19. data/lib/fog/compute/proxmox/models/server_config.rb +56 -24
  20. data/lib/fog/compute/proxmox/models/servers.rb +34 -26
  21. data/lib/fog/compute/proxmox/models/snapshot.rb +28 -14
  22. data/lib/fog/compute/proxmox/models/snapshots.rb +9 -17
  23. data/lib/fog/compute/proxmox/models/storage.rb +15 -11
  24. data/lib/fog/compute/proxmox/models/storages.rb +13 -22
  25. data/lib/fog/compute/proxmox/models/task.rb +10 -14
  26. data/lib/fog/compute/proxmox/models/tasks.rb +9 -18
  27. data/lib/fog/compute/proxmox/models/volume.rb +12 -12
  28. data/lib/fog/compute/proxmox/models/volumes.rb +10 -19
  29. data/lib/fog/compute/proxmox/requests/action_server.rb +1 -4
  30. data/lib/fog/compute/proxmox/requests/clone_server.rb +1 -4
  31. data/lib/fog/compute/proxmox/requests/create_backup.rb +1 -4
  32. data/lib/fog/compute/proxmox/requests/create_server.rb +1 -4
  33. data/lib/fog/compute/proxmox/requests/create_snapshot.rb +1 -4
  34. data/lib/fog/compute/proxmox/requests/create_spice.rb +1 -4
  35. data/lib/fog/compute/proxmox/requests/create_term.rb +1 -4
  36. data/lib/fog/compute/proxmox/requests/create_vnc.rb +1 -4
  37. data/lib/fog/compute/proxmox/requests/delete_server.rb +1 -4
  38. data/lib/fog/compute/proxmox/requests/delete_snapshot.rb +1 -4
  39. data/lib/fog/compute/proxmox/requests/get_node_statistics.rb +1 -4
  40. data/lib/fog/compute/proxmox/requests/get_server_config.rb +1 -4
  41. data/lib/fog/compute/proxmox/requests/get_server_status.rb +1 -4
  42. data/lib/fog/compute/proxmox/requests/{get_snapshot.rb → get_snapshot_config.rb} +5 -8
  43. data/lib/fog/compute/proxmox/requests/get_task.rb +1 -4
  44. data/lib/fog/compute/proxmox/requests/get_vnc.rb +1 -4
  45. data/lib/fog/compute/proxmox/requests/list_nodes.rb +1 -2
  46. data/lib/fog/compute/proxmox/requests/list_storages.rb +3 -1
  47. data/lib/fog/compute/proxmox/requests/log_task.rb +1 -4
  48. data/lib/fog/compute/proxmox/requests/move_disk.rb +1 -4
  49. data/lib/fog/compute/proxmox/requests/move_volume.rb +1 -4
  50. data/lib/fog/compute/proxmox/requests/next_vmid.rb +5 -3
  51. data/lib/fog/compute/proxmox/requests/resize_container.rb +1 -4
  52. data/lib/fog/compute/proxmox/requests/status_task.rb +1 -4
  53. data/lib/fog/compute/proxmox/requests/update_server.rb +1 -4
  54. data/lib/fog/identity/proxmox.rb +2 -8
  55. data/lib/fog/identity/proxmox/models/domain.rb +25 -21
  56. data/lib/fog/identity/proxmox/models/{ldap.rb → domain_type.rb} +9 -18
  57. data/lib/fog/identity/proxmox/models/domains.rb +6 -76
  58. data/lib/fog/identity/proxmox/models/group.rb +6 -19
  59. data/lib/fog/identity/proxmox/models/groups.rb +6 -12
  60. data/lib/fog/identity/proxmox/models/permission.rb +27 -31
  61. data/lib/fog/identity/proxmox/models/permissions.rb +8 -25
  62. data/lib/fog/identity/proxmox/models/pool.rb +9 -22
  63. data/lib/fog/identity/proxmox/models/pools.rb +7 -13
  64. data/lib/fog/identity/proxmox/models/principal.rb +1 -6
  65. data/lib/fog/identity/proxmox/models/role.rb +7 -20
  66. data/lib/fog/identity/proxmox/models/roles.rb +6 -13
  67. data/lib/fog/identity/proxmox/models/user.rb +7 -21
  68. data/lib/fog/identity/proxmox/models/users.rb +6 -12
  69. data/lib/fog/identity/proxmox/requests/check_permissions.rb +1 -4
  70. data/lib/fog/identity/proxmox/requests/list_roles.rb +0 -1
  71. data/lib/fog/identity/proxmox/requests/read_version.rb +1 -5
  72. data/lib/fog/identity/proxmox/requests/update_group.rb +2 -3
  73. data/lib/fog/identity/proxmox/requests/{add_permission.rb → update_permissions.rb} +4 -4
  74. data/lib/fog/network/proxmox/models/network.rb +12 -18
  75. data/lib/fog/network/proxmox/models/networks.rb +11 -17
  76. data/lib/fog/network/proxmox/models/node.rb +14 -10
  77. data/lib/fog/network/proxmox/models/nodes.rb +5 -11
  78. data/lib/fog/network/proxmox/requests/create_network.rb +1 -4
  79. data/lib/fog/network/proxmox/requests/delete_network.rb +1 -4
  80. data/lib/fog/network/proxmox/requests/get_network.rb +1 -4
  81. data/lib/fog/network/proxmox/requests/get_node.rb +1 -4
  82. data/lib/fog/network/proxmox/requests/power_node.rb +1 -4
  83. data/lib/fog/network/proxmox/requests/update_network.rb +1 -4
  84. data/lib/fog/{compute/proxmox/requests/check_vmid.rb → proxmox/attributes.rb} +9 -17
  85. data/lib/fog/proxmox/core.rb +2 -1
  86. data/lib/fog/proxmox/helpers/cpu_helper.rb +6 -3
  87. data/lib/fog/proxmox/helpers/disk_helper.rb +1 -1
  88. data/lib/fog/proxmox/helpers/nic_helper.rb +37 -22
  89. data/lib/fog/proxmox/version.rb +1 -1
  90. data/lib/fog/storage/proxmox.rb +1 -1
  91. data/spec/compute_spec.rb +64 -45
  92. data/spec/fixtures/proxmox/compute/containers.yml +1684 -4137
  93. data/spec/fixtures/proxmox/compute/identity_ticket.yml +4 -4
  94. data/spec/fixtures/proxmox/compute/nodes.yml +21 -21
  95. data/spec/fixtures/proxmox/compute/servers.yml +3065 -7741
  96. data/spec/fixtures/proxmox/compute/snapshots.yml +279 -827
  97. data/spec/fixtures/proxmox/compute/storages.yml +60 -21
  98. data/spec/fixtures/proxmox/compute/tasks.yml +56 -98
  99. data/spec/fixtures/proxmox/identity/auth.yml +6 -6
  100. data/spec/fixtures/proxmox/identity/domains.yml +252 -84
  101. data/spec/fixtures/proxmox/identity/groups.yml +93 -54
  102. data/spec/fixtures/proxmox/identity/identity_ticket.yml +4 -4
  103. data/spec/fixtures/proxmox/identity/permissions.yml +317 -79
  104. data/spec/fixtures/proxmox/identity/pools.yml +266 -71
  105. data/spec/fixtures/proxmox/identity/read_version.yml +6 -6
  106. data/spec/fixtures/proxmox/identity/roles.yml +96 -57
  107. data/spec/fixtures/proxmox/identity/users.yml +224 -107
  108. data/spec/fixtures/proxmox/network/identity_ticket.yml +4 -4
  109. data/spec/fixtures/proxmox/network/networks.yml +54 -95
  110. data/spec/helpers/nic_helper_spec.rb +4 -4
  111. data/spec/identity_spec.rb +38 -46
  112. data/spec/network_spec.rb +1 -1
  113. metadata +9 -23
  114. data/lib/fog/compute/proxmox/models/container.rb +0 -86
  115. data/lib/fog/compute/proxmox/models/container_config.rb +0 -114
  116. data/lib/fog/compute/proxmox/models/containers.rb +0 -43
  117. data/lib/fog/compute/proxmox/requests/get_node.rb +0 -44
  118. data/lib/fog/compute/proxmox/requests/get_storage.rb +0 -44
  119. data/lib/fog/identity/proxmox/models/activedirectory.rb +0 -57
  120. data/lib/fog/identity/proxmox/models/oath.rb +0 -50
  121. data/lib/fog/identity/proxmox/models/pam.rb +0 -46
  122. data/lib/fog/identity/proxmox/models/pve.rb +0 -46
  123. data/lib/fog/identity/proxmox/models/yubico.rb +0 -51
  124. data/lib/fog/identity/proxmox/requests/remove_permission.rb +0 -42
  125. data/lib/fog/proxmox/models/collection.rb +0 -85
  126. data/lib/fog/proxmox/models/model.rb +0 -58
data/spec/network_spec.rb CHANGED
@@ -44,7 +44,7 @@ describe Fog::Network::Proxmox do
44
44
  # Create 1st time
45
45
  node.networks.create(net_hash)
46
46
  # Find by id
47
- network = node.networks.find_by_id net_hash[:iface]
47
+ network = node.networks.get net_hash[:iface]
48
48
  network.wont_be_nil
49
49
  # Create 2nd time
50
50
  proc do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-proxmox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tristan Robert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-02 00:00:00.000000000 Z
11
+ date: 2019-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.16'
19
+ version: '2.0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.16'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: debase
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -319,9 +319,6 @@ files:
319
319
  - fog-proxmox.gemspec
320
320
  - fogproxmox.png
321
321
  - lib/fog/compute/proxmox.rb
322
- - lib/fog/compute/proxmox/models/container.rb
323
- - lib/fog/compute/proxmox/models/container_config.rb
324
- - lib/fog/compute/proxmox/models/containers.rb
325
322
  - lib/fog/compute/proxmox/models/disk.rb
326
323
  - lib/fog/compute/proxmox/models/disks.rb
327
324
  - lib/fog/compute/proxmox/models/interface.rb
@@ -340,7 +337,6 @@ files:
340
337
  - lib/fog/compute/proxmox/models/volume.rb
341
338
  - lib/fog/compute/proxmox/models/volumes.rb
342
339
  - lib/fog/compute/proxmox/requests/action_server.rb
343
- - lib/fog/compute/proxmox/requests/check_vmid.rb
344
340
  - lib/fog/compute/proxmox/requests/clone_server.rb
345
341
  - lib/fog/compute/proxmox/requests/create_backup.rb
346
342
  - lib/fog/compute/proxmox/requests/create_server.rb
@@ -351,12 +347,10 @@ files:
351
347
  - lib/fog/compute/proxmox/requests/delete_server.rb
352
348
  - lib/fog/compute/proxmox/requests/delete_snapshot.rb
353
349
  - lib/fog/compute/proxmox/requests/delete_volume.rb
354
- - lib/fog/compute/proxmox/requests/get_node.rb
355
350
  - lib/fog/compute/proxmox/requests/get_node_statistics.rb
356
351
  - lib/fog/compute/proxmox/requests/get_server_config.rb
357
352
  - lib/fog/compute/proxmox/requests/get_server_status.rb
358
- - lib/fog/compute/proxmox/requests/get_snapshot.rb
359
- - lib/fog/compute/proxmox/requests/get_storage.rb
353
+ - lib/fog/compute/proxmox/requests/get_snapshot_config.rb
360
354
  - lib/fog/compute/proxmox/requests/get_task.rb
361
355
  - lib/fog/compute/proxmox/requests/get_vnc.rb
362
356
  - lib/fog/compute/proxmox/requests/get_volume.rb
@@ -380,26 +374,20 @@ files:
380
374
  - lib/fog/compute/proxmox/requests/update_server.rb
381
375
  - lib/fog/compute/proxmox/requests/update_snapshot.rb
382
376
  - lib/fog/identity/proxmox.rb
383
- - lib/fog/identity/proxmox/models/activedirectory.rb
384
377
  - lib/fog/identity/proxmox/models/domain.rb
378
+ - lib/fog/identity/proxmox/models/domain_type.rb
385
379
  - lib/fog/identity/proxmox/models/domains.rb
386
380
  - lib/fog/identity/proxmox/models/group.rb
387
381
  - lib/fog/identity/proxmox/models/groups.rb
388
- - lib/fog/identity/proxmox/models/ldap.rb
389
- - lib/fog/identity/proxmox/models/oath.rb
390
- - lib/fog/identity/proxmox/models/pam.rb
391
382
  - lib/fog/identity/proxmox/models/permission.rb
392
383
  - lib/fog/identity/proxmox/models/permissions.rb
393
384
  - lib/fog/identity/proxmox/models/pool.rb
394
385
  - lib/fog/identity/proxmox/models/pools.rb
395
386
  - lib/fog/identity/proxmox/models/principal.rb
396
- - lib/fog/identity/proxmox/models/pve.rb
397
387
  - lib/fog/identity/proxmox/models/role.rb
398
388
  - lib/fog/identity/proxmox/models/roles.rb
399
389
  - lib/fog/identity/proxmox/models/user.rb
400
390
  - lib/fog/identity/proxmox/models/users.rb
401
- - lib/fog/identity/proxmox/models/yubico.rb
402
- - lib/fog/identity/proxmox/requests/add_permission.rb
403
391
  - lib/fog/identity/proxmox/requests/change_password.rb
404
392
  - lib/fog/identity/proxmox/requests/check_permissions.rb
405
393
  - lib/fog/identity/proxmox/requests/create_domain.rb
@@ -424,9 +412,9 @@ files:
424
412
  - lib/fog/identity/proxmox/requests/list_roles.rb
425
413
  - lib/fog/identity/proxmox/requests/list_users.rb
426
414
  - lib/fog/identity/proxmox/requests/read_version.rb
427
- - lib/fog/identity/proxmox/requests/remove_permission.rb
428
415
  - lib/fog/identity/proxmox/requests/update_domain.rb
429
416
  - lib/fog/identity/proxmox/requests/update_group.rb
417
+ - lib/fog/identity/proxmox/requests/update_permissions.rb
430
418
  - lib/fog/identity/proxmox/requests/update_pool.rb
431
419
  - lib/fog/identity/proxmox/requests/update_role.rb
432
420
  - lib/fog/identity/proxmox/requests/update_user.rb
@@ -444,6 +432,7 @@ files:
444
432
  - lib/fog/network/proxmox/requests/power_node.rb
445
433
  - lib/fog/network/proxmox/requests/update_network.rb
446
434
  - lib/fog/proxmox.rb
435
+ - lib/fog/proxmox/attributes.rb
447
436
  - lib/fog/proxmox/core.rb
448
437
  - lib/fog/proxmox/errors.rb
449
438
  - lib/fog/proxmox/hash.rb
@@ -452,8 +441,6 @@ files:
452
441
  - lib/fog/proxmox/helpers/disk_helper.rb
453
442
  - lib/fog/proxmox/helpers/nic_helper.rb
454
443
  - lib/fog/proxmox/json.rb
455
- - lib/fog/proxmox/models/collection.rb
456
- - lib/fog/proxmox/models/model.rb
457
444
  - lib/fog/proxmox/variables.rb
458
445
  - lib/fog/proxmox/version.rb
459
446
  - lib/fog/storage/proxmox.rb
@@ -503,8 +490,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
503
490
  - !ruby/object:Gem::Version
504
491
  version: '0'
505
492
  requirements: []
506
- rubyforge_project:
507
- rubygems_version: 2.7.6
493
+ rubygems_version: 3.0.3
508
494
  signing_key:
509
495
  specification_version: 4
510
496
  summary: Module for the 'Fog' gem to support Proxmox VE
@@ -1,86 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2018 Tristan Robert
4
-
5
- # This file is part of Fog::Proxmox.
6
-
7
- # Fog::Proxmox 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
- # Fog::Proxmox 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 Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
19
-
20
- require 'fog/compute/proxmox/models/server'
21
- require 'fog/compute/proxmox/models/container_config'
22
-
23
- module Fog
24
- module Compute
25
- class Proxmox
26
- # Container model
27
- class Container < Fog::Compute::Proxmox::Server
28
- identity :vmid
29
- attribute :lock
30
- attribute :maxswap
31
- attribute :swap
32
- attribute :config
33
-
34
- def restore(backup, options = {})
35
- requires :node, :vmid
36
- path_params = { node: node, type: type }
37
- body_params = options.merge(vmid: vmid, ostemplate: backup.volid, force: 1, restore: 1)
38
- task_upid = service.create_server(path_params, body_params)
39
- tasks.wait_for(task_upid)
40
- end
41
-
42
- def move(volume, storage, options = {})
43
- requires :vmid, :node
44
- path_params = { node: node, vmid: vmid }
45
- body_params = options.merge(volume: volume, storage: storage)
46
- task_upid = service.move_volume(path_params, body_params)
47
- tasks.wait_for(task_upid)
48
- end
49
-
50
- def update(config = {})
51
- requires :node, :vmid
52
- path_params = { node: node, type: type, vmid: vmid }
53
- body_params = config
54
- service.update_server(path_params, body_params)
55
- end
56
-
57
- def set_config(attributes = {})
58
- @config = Fog::Compute::Proxmox::ContainerConfig.new({ service: service, vmid: vmid }.merge(attributes))
59
- end
60
-
61
- def config
62
- path_params = { node: node, type: type, vmid: vmid }
63
- set_config(service.get_server_config(path_params)) if uptime
64
- @config
65
- end
66
-
67
- def detach(mpid)
68
- update(delete: mpid)
69
- end
70
-
71
- def extend(disk, size, options = {})
72
- requires :vmid, :node
73
- path_params = { node: node, vmid: vmid }
74
- body_params = options.merge(disk: disk, size: size)
75
- task_upid = service.resize_container(path_params, body_params)
76
- tasks.wait_for(task_upid)
77
- end
78
-
79
- def action(action, options = {})
80
- raise Fog::Errors::Error, "Action #{action} not implemented" unless %w[start stop shutdown].include? action
81
- super
82
- end
83
- end
84
- end
85
- end
86
- end
@@ -1,114 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2018 Tristan Robert
4
-
5
- # This file is part of Fog::Proxmox.
6
-
7
- # Fog::Proxmox 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
- # Fog::Proxmox 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 Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
19
-
20
- require 'fog/proxmox/variables'
21
- require 'fog/proxmox/helpers/nic_helper'
22
- require 'fog/proxmox/helpers/controller_helper'
23
-
24
- module Fog
25
- module Compute
26
- class Proxmox
27
- # ContainerConfig model
28
- class ContainerConfig < Fog::Proxmox::Model
29
- identity :vmid
30
- attribute :digest
31
- attribute :ostype
32
- attribute :storage
33
- attribute :template
34
- attribute :arch
35
- attribute :memory
36
- attribute :swap
37
- attribute :hostname
38
- attribute :nameserver
39
- attribute :searchdomain
40
- attribute :password
41
- attribute :onboot
42
- attribute :startup
43
- attribute :rootfs
44
- attribute :cores
45
- attribute :cpuunits
46
- attribute :cpulimit
47
- attribute :description
48
- attribute :console
49
- attribute :cmode
50
- attribute :tty
51
- attribute :force
52
- attribute :lock
53
- attribute :pool
54
- attribute :bwlimit
55
- attribute :unprivileged
56
- attribute :interfaces
57
- attribute :mount_points
58
-
59
- def initialize(attributes = {})
60
- prepare_service_value(attributes)
61
- compute_nets(attributes)
62
- compute_mps(attributes)
63
- super(attributes)
64
- end
65
-
66
- attr_reader :interfaces
67
-
68
- attr_reader :mount_points
69
-
70
- def mac_addresses
71
- Fog::Proxmox::NicHelper.to_mac_adresses_array(interfaces)
72
- end
73
-
74
- def type_console
75
- 'vnc' # by default. term is available too
76
- end
77
-
78
- private
79
-
80
- def compute_nets(attributes)
81
- nets = Fog::Proxmox::NicHelper.collect_nics(attributes)
82
- @interfaces ||= Fog::Compute::Proxmox::Interfaces.new
83
- nets.each do |key, value|
84
- nic_hash = {
85
- id: key.to_s,
86
- name: Fog::Proxmox::NicHelper.extract_name(value),
87
- mac: Fog::Proxmox::NicHelper.extract_mac_address(value)
88
- }
89
- names = Fog::Compute::Proxmox::Interface.attributes.reject { |key, _value| %i[id mac name].include? key }
90
- names.each { |name| nic_hash.store(name.to_sym, Fog::Proxmox::ControllerHelper.extract(name, value)) }
91
- @interfaces << Fog::Compute::Proxmox::Interface.new(nic_hash)
92
- end
93
- end
94
-
95
- def compute_mps(attributes)
96
- controllers = Fog::Proxmox::ControllerHelper.collect_controllers(attributes)
97
- @mount_points ||= Fog::Compute::Proxmox::Disks.new
98
- controllers.each do |key, value|
99
- storage, volid, size = Fog::Proxmox::DiskHelper.extract_storage_volid_size(value)
100
- disk_hash = {
101
- id: key.to_s,
102
- storage: storage,
103
- volid: volid,
104
- size: size
105
- }
106
- names = Fog::Compute::Proxmox::Disk.attributes.reject { |key, _value| %i[id size storage volid].include? key }
107
- names.each { |name| disk_hash.store(name.to_sym, Fog::Proxmox::ControllerHelper.extract(name, value)) }
108
- @mount_points << Fog::Compute::Proxmox::Disk.new(disk_hash)
109
- end
110
- end
111
- end
112
- end
113
- end
114
- end
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2018 Tristan Robert
4
-
5
- # This file is part of Fog::Proxmox.
6
-
7
- # Fog::Proxmox 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
- # Fog::Proxmox 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 Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
19
-
20
- require 'fog/compute/proxmox/models/server'
21
-
22
- module Fog
23
- module Compute
24
- class Proxmox
25
- # Containers Collection
26
- class Containers < Fog::Compute::Proxmox::Servers
27
- model Fog::Compute::Proxmox::Container
28
-
29
- def initialize(attributes = {})
30
- super(attributes)
31
- end
32
-
33
- def type
34
- 'lxc'
35
- end
36
-
37
- def new(attributes = {})
38
- super({ node: node, type: type }.merge(attributes))
39
- end
40
- end
41
- end
42
- end
43
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
- # Copyright 2018 Tristan Robert
3
-
4
- # This file is part of Fog::Proxmox.
5
-
6
- # Fog::Proxmox is free software: you can redistribute it and/or modify
7
- # it under the terms of the GNU General Public License as published by
8
- # the Free Software Foundation, either version 3 of the License, or
9
- # (at your option) any later version.
10
-
11
- # Fog::Proxmox is distributed in the hope that it will be useful,
12
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- # GNU General Public License for more details.
15
-
16
- # You should have received a copy of the GNU General Public License
17
- # along with Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
18
-
19
- # frozen_string_literal: true
20
-
21
- require 'fog/proxmox/json'
22
-
23
- module Fog
24
- module Compute
25
- class Proxmox
26
- # class Real get_node request
27
- class Real
28
- def get_node(node)
29
- response = request(
30
- expects: [200],
31
- method: 'GET',
32
- path: "nodes/#{node}/status"
33
- )
34
- Fog::Proxmox::Json.get_data(response)
35
- end
36
- end
37
-
38
- # class Mock get_node request
39
- class Mock
40
- def get_node; end
41
- end
42
- end
43
- end
44
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # Copyright 2018 Tristan Robert
4
-
5
- # This file is part of Fog::Proxmox.
6
-
7
- # Fog::Proxmox 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
- # Fog::Proxmox 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 Fog::Proxmox. If not, see <http://www.gnu.org/licenses/>.
19
-
20
- require 'fog/proxmox/json'
21
-
22
- module Fog
23
- module Compute
24
- class Proxmox
25
- # class Real get_storage request
26
- class Real
27
- def get_storage(node, storage, options)
28
- response = request(
29
- expects: [200],
30
- method: 'GET',
31
- path: "nodes/#{node}/storage/#{storage}/status",
32
- query: URI.encode_www_form(options)
33
- )
34
- Fog::Proxmox::Json.get_data(response)
35
- end
36
- end
37
-
38
- # class Mock get_storage request
39
- class Mock
40
- def get_storage; end
41
- end
42
- end
43
- end
44
- end