radfish-supermicro 0.2.2 → 0.2.3
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 +4 -4
- data/lib/radfish/supermicro/version.rb +1 -1
- data/lib/radfish/supermicro_adapter.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45d69cff8a4fa9b65df7c4d70d77b5ffa0f1235630f47d2f9cea14260ee49819
|
4
|
+
data.tar.gz: 993665ad5c2b9c66c916e60803db3958fdfca4eccb2f4561c60ab6647d973118
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 354be81ceb943af7f5598b81deac1ff632df2a2caf100d3782c15582a67fb998922d5629c8050eb721fc0273220e9728c32056ae8998bdb4dd20a6fe53f8397f
|
7
|
+
data.tar.gz: 510680fa6b291f7a580a388171dd635a5d987205e6ed79e2ca472b2d7982cdef695b98b8775d795bea1db41aed011046a90ea755a77eafdbaa6283e671a57fd7
|
@@ -346,6 +346,24 @@ module Radfish
|
|
346
346
|
|
347
347
|
volume_data = @supermicro_client.volumes(controller_id)
|
348
348
|
|
349
|
+
# Normalize basic fields for consistency, and attach drive refs if missing
|
350
|
+
volume_data.each do |v|
|
351
|
+
v["raid_type"] ||= v["RAIDType"] if v["RAIDType"]
|
352
|
+
v["volume_type"] ||= v["VolumeType"] if v["VolumeType"]
|
353
|
+
v["health"] ||= v.dig("Status", "Health") if v["Status"].is_a?(Hash)
|
354
|
+
if v["drives"].nil? && v["@odata.id"]
|
355
|
+
begin
|
356
|
+
resp = @supermicro_client.authenticated_request(:get, v["@odata.id"])
|
357
|
+
if resp.status == 200
|
358
|
+
data = JSON.parse(resp.body)
|
359
|
+
v["drives"] = data.dig('Links', 'Drives') || []
|
360
|
+
end
|
361
|
+
rescue => e
|
362
|
+
debug "Could not fetch volume drives: #{e.message}", 2, :yellow
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
349
367
|
# Convert to OpenStruct for consistency
|
350
368
|
volume_data.map { |volume| OpenStruct.new(volume) }
|
351
369
|
end
|