fog-proxmox 0.15.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fbbd25ac2c953f21c2a4f5b9ab59e30269ab68f9f832abf4dc740743e10a93ec
4
- data.tar.gz: 3c20988aca648ae685ce5c8e86c17af02ae667bbf6fe53ee012616fec2300ebe
3
+ metadata.gz: b8570832df51a02eaf643d8ff711aded5ed8f664168eb2c1e0e8b3dec1f4b309
4
+ data.tar.gz: c162e5cddd1f8c809310d95b82bce305e2a48c19dad469c432ffd77f8f733723
5
5
  SHA512:
6
- metadata.gz: 813919e970090cde4ccac7ec991b06f4a8380bdf0a1e0e85c0f5b73fce6da91d48da381bcba239ba995e5b706d80bf6b9123823f66420967685deb350dd30a22
7
- data.tar.gz: 3d638a97782b63a70e12237e6494bf67386e019b287965eb02d36c92f7c097c36a443fe84b2e53464f13895984be7f9141171a4212fab8d3792d08ebab85920d
6
+ metadata.gz: caa4247e9c6f778ad157ba72561f04da0876a6e2d5acd185c93dc84c5ecba5168f1fb3ae3d6a87ddb803d26271963e101f51b8aef5955877ee2f3434cb8de60a
7
+ data.tar.gz: 8dee3cdb18fe8c1e6ec5103adfb311d6d5d946b44cf3b73acba3b66808321306ea0542c7d40111f53d2b681a1d39b87b2fd43949d5fd15468fd496b66e704184
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.15.1](https://github.com/fog/fog-proxmox/compare/v0.15.0...v0.15.1) (2025-02-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * Fixes EOF OpenSSL error in Proxmox connection ([#102](https://github.com/fog/fog-proxmox/issues/102)) ([ac8b0e1](https://github.com/fog/fog-proxmox/commit/ac8b0e11a39da6b19703b4f4507edf19486899ba))
9
+
3
10
  ## [0.15.0](https://github.com/fog/fog-proxmox/compare/v0.14.0...v0.15.0) (2022-12-01)
4
11
 
5
12
 
@@ -26,6 +26,7 @@ module Fog
26
26
  module Proxmox
27
27
  class Compute
28
28
  # Server model
29
+ # rubocop:disable ClassLength
29
30
  class Server < Fog::Compute::Server
30
31
  identity :vmid
31
32
  attribute :type
@@ -72,6 +73,10 @@ module Fog
72
73
  super(new_attributes)
73
74
  end
74
75
 
76
+ def to_s
77
+ name
78
+ end
79
+
75
80
  def container?
76
81
  type == 'lxc'
77
82
  end
@@ -260,6 +265,7 @@ module Fog
260
265
  Fog::Proxmox::Compute::Node.new(service: service, node: node_id)
261
266
  end
262
267
  end
268
+ # rubocop:enable ClassLength
263
269
  end
264
270
  end
265
271
  end
@@ -51,7 +51,7 @@ module Fog
51
51
 
52
52
  def save
53
53
  path_params = { node: node_id, type: server_type, vmid: server_id }
54
- body_params = { snapname: name }
54
+ body_params = { snapname: name, vmstate: vmstate }
55
55
  server.tasks.wait_for(service.create_snapshot(path_params, body_params))
56
56
  end
57
57
 
@@ -54,7 +54,7 @@ module Fog
54
54
  end
55
55
 
56
56
  def succeeded?
57
- finished? && exitstatus == 'OK'
57
+ finished? && (exitstatus == 'OK' || exitstatus.include?('WARNING'))
58
58
  end
59
59
 
60
60
  def finished?
@@ -53,6 +53,7 @@ module Fog
53
53
  @connection_options = options[:connection_options] || {}
54
54
  @connection_options[:disable_proxy] = true if ENV['DISABLE_PROXY'] == 'true'
55
55
  @connection_options[:ssl_verify_peer] = false if ENV['SSL_VERIFY_PEER'] == 'false'
56
+ @connection_options[:ignore_unexpected_eof] = true
56
57
  @proxmox_must_reauthenticate = true
57
58
  @persistent = options[:persistent] || false
58
59
  @token ||= options[:proxmox_token]
@@ -118,10 +118,10 @@ module Fog
118
118
  end
119
119
 
120
120
  def self.to_human_bytes(size)
121
- units = %w[Kb Mb Gb Tb Pb]
121
+ units = %w[Kb Mb Gb]
122
122
  i = 0
123
123
  human_size = size.to_s + 'b'
124
- while i < 5 && size >= 1024
124
+ while i < 3 && size >= 1024
125
125
  size = modulo_bytes(size)
126
126
  human_size = size.to_s + units[i]
127
127
  i += 1
@@ -98,12 +98,19 @@ module Fog
98
98
 
99
99
  # Convert nic attributes hash into API Proxmox parameters string
100
100
  def self.flatten(nic_hash)
101
- nic_id = nic_hash[nic_name(nic_hash).to_sym]
102
- nic_value = set_mac(nic_id, nic_hash)
103
- options = nic_hash.reject do |key, _value|
104
- [nic_name(nic_hash).to_sym, :id, :macaddr, :hwaddr].include? key.to_sym
101
+ if nic_hash[:hwaddr].nil?
102
+ nic_id = nic_hash[nic_name(nic_hash).to_sym]
103
+ nic_value = set_mac(nic_id, nic_hash)
104
+ options = nic_hash.reject do |key, _value|
105
+ [nic_name(nic_hash).to_sym, :id, :hwaddr, :macaddr].include? key.to_sym
106
+ end
107
+ nic_value += ',' + Fog::Proxmox::Hash.stringify(options) unless options.empty?
108
+ else
109
+ options = nic_hash.reject do |key, _value|
110
+ %i[id model macaddr].include? key.to_sym
111
+ end
112
+ nic_value = Fog::Proxmox::Hash.stringify(options) unless options.empty?
105
113
  end
106
- nic_value += ',' + Fog::Proxmox::Hash.stringify(options) unless options.empty?
107
114
  { "#{nic_hash[:id]}": nic_value }
108
115
  end
109
116
 
@@ -19,6 +19,6 @@
19
19
 
20
20
  module Fog
21
21
  module Proxmox
22
- VERSION = '0.15.0'
22
+ VERSION = '0.15.1'
23
23
  end
24
24
  end
data/spec/compute_spec.rb CHANGED
@@ -277,15 +277,16 @@ describe Fog::Proxmox::Compute do
277
277
 
278
278
  it 'CRUD snapshots' do
279
279
  VCR.use_cassette('snapshots') do
280
- node_name = 'pve'
280
+ node_name = 'proxmox-noris'
281
281
  node = @service.nodes.get node_name
282
282
  vmid = node.servers.next_id
283
283
  server_hash = { vmid: vmid }
284
284
  node.servers.create server_hash
285
285
  # Create
286
286
  snapname = 'snapshot1'
287
+ vmstate = 0
287
288
  server = node.servers.get vmid
288
- snapshot_hash = { name: snapname }
289
+ snapshot_hash = { name: snapname, vmstate: vmstate }
289
290
  server.snapshots.create(snapshot_hash)
290
291
  # Find by id
291
292
  snapshot = server.snapshots.get snapname