radfish-supermicro 0.1.5 → 0.2.0

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: 4a0045b1cbad8f48e84fad5836a53ff4d3e49b69230f709722698934c9245564
4
- data.tar.gz: 0d8a00612b320df6135f3d8f16548c96d6dbef15bb0aafc26235dac374c78dfd
3
+ metadata.gz: '091a79bdcb460394274e35673826de2b0a0d92276723fda7c5964e436cdb2131'
4
+ data.tar.gz: 5ed7ad3a21c2362cee2353a9be01b90fa1fe979a6392d30130baaa8e8490829f
5
5
  SHA512:
6
- metadata.gz: 50a0bb9db7c28d0502a8259da5a1e3d30a55b596bfa153a74dd426782fec20600be6929e4bf3a9f2f5f2c027f5aa36e11d86a01a90d0f7f6d353b97a3a08315e
7
- data.tar.gz: 35b56e38c069d0581d7572726b5b05c36c27dc068c16385dbd194d8fa68a120ab4346bf8d6b0cb023919288dfef06580d580dacb4a64c28c02ed951f0aa0a43e
6
+ metadata.gz: 2ca6e946b739c0d6346c2e5c2ab12d0a54920dff870b92aeadbd26881425aac0be9053f717cc8d54cb8804a46d86a77a3a55fcf6087ba64ff6730dec28979c24
7
+ data.tar.gz: 13fe882019ca53655ba5d39260abc219f8aa60d861e238e8c2a95f1a0cd097910e2d33a99f51fb977e797f88f72a126aef645af84762f3f3fd7fd01b2b4a480a
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Radfish
4
4
  module Supermicro
5
- VERSION = "0.1.5"
5
+ VERSION = "0.2.0"
6
6
  end
7
- end
7
+ end
@@ -320,17 +320,47 @@ module Radfish
320
320
  end
321
321
  end
322
322
 
323
- def drives
324
- @supermicro_client.drives
323
+ def drives(controller)
324
+ # The Supermicro gem requires a controller identifier; derive it from the controller
325
+ raise ArgumentError, "Controller required" unless controller
326
+ controller_id = extract_controller_identifier(controller)
327
+ raise ArgumentError, "Controller identifier missing" unless controller_id
328
+
329
+ drive_data = @supermicro_client.drives(controller_id)
330
+
331
+ # Convert to OpenStruct for consistency
332
+ drive_data.map { |drive| OpenStruct.new(drive) }
325
333
  end
326
334
 
327
- def volumes
328
- @supermicro_client.volumes
335
+ def volumes(controller)
336
+ # The Supermicro gem requires a controller identifier; derive it from the controller
337
+ raise ArgumentError, "Controller required" unless controller
338
+ controller_id = extract_controller_identifier(controller)
339
+ raise ArgumentError, "Controller identifier missing" unless controller_id
340
+
341
+ volume_data = @supermicro_client.volumes(controller_id)
342
+
343
+ # Convert to OpenStruct for consistency
344
+ volume_data.map { |volume| OpenStruct.new(volume) }
329
345
  end
330
346
 
331
347
  def storage_summary
332
348
  @supermicro_client.storage_summary
333
349
  end
350
+
351
+ private
352
+
353
+ def extract_controller_identifier(controller)
354
+ raw = controller.respond_to?(:adapter_data) ? controller.adapter_data : controller
355
+ if defined?(OpenStruct) && raw.is_a?(OpenStruct)
356
+ table = raw.instance_variable_get(:@table)
357
+ table && (table[:"@odata.id"] || table["@odata.id"]) || controller.id
358
+ elsif raw.respond_to?(:[])
359
+ raw['@odata.id'] || raw[:'@odata.id'] || controller.id
360
+ else
361
+ controller.id
362
+ end
363
+ end
334
364
 
335
365
  # Virtual Media
336
366
 
@@ -699,4 +729,4 @@ module Radfish
699
729
  # Register the adapter
700
730
  Radfish.register_adapter('supermicro', SupermicroAdapter)
701
731
  Radfish.register_adapter('smc', SupermicroAdapter)
702
- end
732
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radfish-supermicro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel