radfish-supermicro 0.1.6 → 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: 202dcec4a1ba67974964ada0218d40876d291858bba3de7d163f401c05206fd9
4
- data.tar.gz: a944dca7885e3df865a6ba44f2b776c321dfbce0480ed11533e49d92fa91e21f
3
+ metadata.gz: '091a79bdcb460394274e35673826de2b0a0d92276723fda7c5964e436cdb2131'
4
+ data.tar.gz: 5ed7ad3a21c2362cee2353a9be01b90fa1fe979a6392d30130baaa8e8490829f
5
5
  SHA512:
6
- metadata.gz: 9fbe20bfba799ddb24d2a7b14aaf66d4d123c4a5b15a4cebf2f52dac6a2a501c420d29662cfb432a06bb667666404d9b4721e5caf0a60b855f75d2df429c766e
7
- data.tar.gz: 642e58e514d1baa77c972cfa4acb520d692490e421e273b92fd8b5a9b8e73ec342f3fdd460cc64e5b76a1de00a74ccf266fab04da01af31736354669e7ba2dbe
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.6"
5
+ VERSION = "0.2.0"
6
6
  end
7
- end
7
+ end
@@ -320,9 +320,11 @@ module Radfish
320
320
  end
321
321
  end
322
322
 
323
- def drives(controller_id)
324
- # The Supermicro gem now requires controller_id following natural Redfish pattern
325
- raise ArgumentError, "Controller ID is required" unless controller_id
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
326
328
 
327
329
  drive_data = @supermicro_client.drives(controller_id)
328
330
 
@@ -330,9 +332,11 @@ module Radfish
330
332
  drive_data.map { |drive| OpenStruct.new(drive) }
331
333
  end
332
334
 
333
- def volumes(controller_id)
334
- # The Supermicro gem now requires controller_id following natural Redfish pattern
335
- raise ArgumentError, "Controller ID is required" unless controller_id
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
336
340
 
337
341
  volume_data = @supermicro_client.volumes(controller_id)
338
342
 
@@ -343,6 +347,20 @@ module Radfish
343
347
  def storage_summary
344
348
  @supermicro_client.storage_summary
345
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
346
364
 
347
365
  # Virtual Media
348
366
 
@@ -711,4 +729,4 @@ module Radfish
711
729
  # Register the adapter
712
730
  Radfish.register_adapter('supermicro', SupermicroAdapter)
713
731
  Radfish.register_adapter('smc', SupermicroAdapter)
714
- 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.6
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel