radfish 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: e7628a9f6e1b6d8636e8755018a7b6468a525657b4e7d0c014b7eee13b93176f
4
- data.tar.gz: 5923533c409bd4a0a4976c41b063e3a8af9d8f88380089627e7aed35151077af
3
+ metadata.gz: 73011007c472b46cd1b41258548fdc37da25f15a4d14c370809aeafe5d67953b
4
+ data.tar.gz: 0b649b8aa1b6c5d05eae02641b2fef7fc6bb9d45b913fdd7727c875c69c62562
5
5
  SHA512:
6
- metadata.gz: fb93b21b54e808e17a557440d029438291098f5bfffeafd7a79cde3c4353e517f1100aa01107b60c796e77ad48bf0c739d7aa5a79742cbca0e92d5d3a3c67324
7
- data.tar.gz: 10f0e4b034e548b63d119b818c00a66884d865d681145aeb605fd959cd6d43c27701a556e340ec48c47a13641152c8ca594a0b28164cdb86a1a7cf10f1284ac7
6
+ metadata.gz: 65195d4125e3afb35707adc1b87d1370de1df0b2e19afe6a5a7e56a0ace94a8437b83f9c70d1d6ada0861074d7dede5d3ccb06c5861e1e20aec95388d79ae763
7
+ data.tar.gz: c99fcf649bb95dd02a861457920c310f276ec544f86fa3016771953dd277ac8a9c996add49207c59fa7f200384db570ae2b45d64abe2612663145e5b13085b98
@@ -152,6 +152,7 @@ module Radfish
152
152
  features << :boot if @adapter.respond_to?(:boot_options)
153
153
  features << :jobs if @adapter.respond_to?(:jobs)
154
154
  features << :utility if @adapter.respond_to?(:sel_log)
155
+ features << :network if @adapter.respond_to?(:get_bmc_network) || @adapter.respond_to?(:set_bmc_network)
155
156
 
156
157
  features
157
158
  end
@@ -187,18 +188,30 @@ module Radfish
187
188
  private
188
189
 
189
190
  def build_controller(raw)
190
- # Only extract friendly name/id if plainly available; keep raw in adapter_data
191
- id = if raw.respond_to?(:[])
192
- raw['id'] || raw[:id]
193
- elsif raw.respond_to?(:id)
194
- raw.id
195
- end
196
- name = if raw.respond_to?(:[])
197
- raw['name'] || raw[:name]
198
- elsif raw.respond_to?(:name)
199
- raw.name
200
- end
201
- Controller.new(client: self, id: id, name: name, vendor: @vendor, adapter_data: raw)
191
+ # Expect adapters to provide normalized fields; keep mapping straightforward.
192
+ fetch = ->(key) do
193
+ if raw.respond_to?(:[])
194
+ raw[key.to_s] || raw[key.to_sym]
195
+ elsif raw.respond_to?(key.to_sym)
196
+ raw.public_send(key.to_sym)
197
+ end
198
+ end
199
+
200
+ Controller.new(
201
+ client: self,
202
+ id: fetch.call(:id),
203
+ name: fetch.call(:name),
204
+ model: fetch.call(:model),
205
+ firmware_version: fetch.call(:firmware_version),
206
+ encryption_mode: fetch.call(:encryption_mode),
207
+ encryption_capability: fetch.call(:encryption_capability),
208
+ controller_type: fetch.call(:controller_type),
209
+ pci_slot: fetch.call(:pci_slot),
210
+ status: fetch.call(:status),
211
+ drives_count: fetch.call(:drives_count),
212
+ vendor: @vendor,
213
+ adapter_data: raw
214
+ )
202
215
  end
203
216
  end
204
217
  end
@@ -4,14 +4,26 @@ module Radfish
4
4
  # Lightweight value object representing a storage controller.
5
5
  # Holds a stable identifier and optional name.
6
6
  class Controller
7
- attr_reader :id, :name, :vendor, :adapter_data
7
+ attr_reader :id, :name, :model, :vendor, :adapter_data, :firmware_version,
8
+ :encryption_mode, :encryption_capability, :controller_type,
9
+ :pci_slot, :status, :drives_count
8
10
 
9
- def initialize(client:, id:, name: nil, vendor: nil, adapter_data: nil)
11
+ def initialize(client:, id:, name: nil, model: nil, vendor: nil, adapter_data: nil,
12
+ firmware_version: nil, encryption_mode: nil, encryption_capability: nil,
13
+ controller_type: nil, pci_slot: nil, status: nil, drives_count: nil)
10
14
  @client = client
11
15
  @id = id
12
16
  @name = name
17
+ @model = model
13
18
  @vendor = vendor
14
19
  @adapter_data = adapter_data
20
+ @firmware_version = firmware_version
21
+ @encryption_mode = encryption_mode
22
+ @encryption_capability = encryption_capability
23
+ @controller_type = controller_type
24
+ @pci_slot = pci_slot
25
+ @status = status
26
+ @drives_count = drives_count
15
27
  end
16
28
 
17
29
  # Convenience accessors delegate to the client wrappers
@@ -24,11 +36,24 @@ module Radfish
24
36
  end
25
37
 
26
38
  def to_h
27
- { id: id, name: name, vendor: vendor }
39
+ {
40
+ id: id,
41
+ name: name,
42
+ model: model,
43
+ vendor: vendor,
44
+ firmware_version: firmware_version,
45
+ encryption_mode: encryption_mode,
46
+ encryption_capability: encryption_capability,
47
+ controller_type: controller_type,
48
+ pci_slot: pci_slot,
49
+ status: status,
50
+ drives_count: drives_count
51
+ }.compact
28
52
  end
29
53
 
30
54
  def ==(other)
31
55
  other.is_a?(Controller) && other.id == id && other.vendor.to_s == vendor.to_s
32
56
  end
57
+
33
58
  end
34
59
  end
@@ -18,6 +18,7 @@ module Radfish
18
18
  def storage_summary
19
19
  raise NotImplementedError, "Adapter must implement #storage_summary"
20
20
  end
21
+
21
22
  end
22
23
  end
23
24
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Radfish
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.3"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radfish
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