radfish-idrac 0.2.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 498ca5982c494dc12664edf49adb339c54e4a6c642b649e307ce73ca5b13b760
4
- data.tar.gz: ef423da63f06a0a0931b82c9faf2427b46ec91d85b647dac560cb957020dc042
3
+ metadata.gz: 9e06ed50701a0a34c99711a2cba0e5ee4238667d75988b7c78f06b66c6f08cf9
4
+ data.tar.gz: a4e88ec48073815ff1e368d5bd93b1c4d14b9b5dd44bcb0324e0aa037e79430d
5
5
  SHA512:
6
- metadata.gz: f02763dccf483a5c969d6752a09db593249393b0983544d664c77f68e410d53fd63f1fc69a2201ccf9434560841f501492cf7491ae2ccc2d9a5d513dcabc5596
7
- data.tar.gz: bbbca9598994cbe3ed5e38c55a6e5fe4a7672b0607168c624b2e4944098f6140ea569b5b7251c0f97786bea370dda9f17fc438e7e901a03a7b49ccc5657dd85b
6
+ metadata.gz: 1b189ac7729869a390ff50e4043a4eccd92dbf3fcab823d338130895a735ff7f1d30dd3d03aa3b5611d4eb5f54e8e8cab4e57307eebd82b33153049f1930c633
7
+ data.tar.gz: 451835735540908ea5a129e50dacc003088d2411d03eb89826ec4d423de594d49767c353dda430329a40df05639a9e7b8bfb76a075dc5bd091cbdad71a51fc22
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Radfish
4
4
  module Idrac
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.3"
6
6
  end
7
7
  end
@@ -294,6 +294,15 @@ module Radfish
294
294
  controller_data = @idrac_client.controllers
295
295
 
296
296
  controller_data.map do |controller|
297
+ # Promote battery status if available in OEM fields
298
+ begin
299
+ battery = controller.dig("Oem", "Dell", "DellControllerBattery")
300
+ if battery
301
+ controller["battery_status"] ||= (battery["PrimaryStatus"] || battery["RAIDState"])
302
+ end
303
+ rescue => e
304
+ debug "Battery status parse error: #{e.message}", 2, :yellow
305
+ end
297
306
  # Convert drives array to OpenStruct objects if present
298
307
  if controller["drives"]
299
308
  controller["drives"] = controller["drives"].map { |drive| OpenStruct.new(drive) }
@@ -325,6 +334,33 @@ module Radfish
325
334
  # Convert to OpenStruct for consistency
326
335
  volume_data.map { |volume| OpenStruct.new(volume) }
327
336
  end
337
+
338
+ def volume_drives(volume)
339
+ # Resolve the physical drives that make up a volume
340
+ raise ArgumentError, "Volume required" unless volume
341
+ controller_id = extract_controller_identifier(volume.controller)
342
+ # Get all drives on the controller
343
+ drives = @idrac_client.drives(controller_id)
344
+ # The IDRAC client drive entries include 'odata_id'; volumes include Links.Drives as '@odata.id'
345
+ refs = nil
346
+ raw = volume.adapter_data
347
+ if raw.respond_to?(:[])
348
+ refs = raw['drives'] || raw[:drives]
349
+ elsif raw.respond_to?(:drives)
350
+ refs = raw.drives
351
+ end
352
+ return [] unless refs && refs.respond_to?(:map)
353
+ ref_ids = refs.map { |r| r['@odata.id'] || r[:'@odata.id'] }.compact
354
+ matched = drives.select do |d|
355
+ oid = if d.is_a?(Hash)
356
+ d['odata_id'] || d[:odata_id] || d['@odata.id'] || d[:'@odata.id']
357
+ elsif d.respond_to?(:[])
358
+ d['odata_id'] || d['@odata.id']
359
+ end
360
+ oid && ref_ids.include?(oid)
361
+ end
362
+ matched.map { |drive| OpenStruct.new(drive) }
363
+ end
328
364
 
329
365
  def storage_summary
330
366
  # The iDRAC gem doesn't have a storage_summary method
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radfish-idrac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel