radfish-ami 0.1.2 → 0.1.4

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: 4a6767dac25a52c3487bb03d27e87ba1f6b86446999b9c911e56e5c03a249238
4
- data.tar.gz: 8ec968e4cb4e7fab05a12268e9d4bc6e24e5b8c58e33d65fd138482362e5a6f5
3
+ metadata.gz: 0b9d6c1504f5b0420021db42cf51f92f4864b57e829ab2167526758889f42a0a
4
+ data.tar.gz: 23b729993a4fd05476a6737f2b7eed8d21c6d4b297f850ea5b5dda35659897c8
5
5
  SHA512:
6
- metadata.gz: 9364ad69a1ed099c1df80c6482a182c33da58ae4b1f37c31be3b44f5ec0cbed85736c5850242d4c1355c485f6080ad0ad8c53b7a6d580a11aa18815a698c6cc0
7
- data.tar.gz: f1ce4e6eb97e276db96dbfd9f1e75780a45347908bb1dfa0b9b4a0fe2f04049ca85196eddff83b3c66dd1331536477a9d4ca2d6b20d855432e4687549a611c7a
6
+ metadata.gz: aa22eff985917551a7b889041c667f888b82dcc07c8f6dd95303c5b46c7d79152aa785bf9b3f01a22ffe4deb8683fb8a4d3486add7541e2fb51e3be658087cef
7
+ data.tar.gz: 94b80ed7c35a5bbf43d8f4ee73f5b988e34f8d95a7932ed6df295241d595aa941d2df896d4f670a71c516cebbc4000fde21a7d67c6357bbdc01128d8098688ff
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Radfish
4
4
  module Ami
5
- VERSION = "0.1.2"
5
+ VERSION = "0.1.4"
6
6
  end
7
7
  end
@@ -137,7 +137,43 @@ module Radfish
137
137
 
138
138
  def system_health
139
139
  info = system_info
140
- info.dig("Status", "Health") || info.dig("Status", "HealthRollup") || "Unknown"
140
+ status = info["Status"] || {}
141
+ HealthStatus.new(
142
+ health: status["Health"] || "Unknown",
143
+ rollup: status["HealthRollup"] || status["Health"] || "Unknown"
144
+ )
145
+ end
146
+
147
+ # Simple struct for health status with rollup
148
+ class HealthStatus
149
+ attr_reader :health, :rollup
150
+
151
+ def initialize(health:, rollup:)
152
+ @health = health
153
+ @rollup = rollup
154
+ end
155
+
156
+ def to_s
157
+ @health
158
+ end
159
+
160
+ def ==(other)
161
+ other.to_s == to_s
162
+ end
163
+ end
164
+
165
+ def bmc_info
166
+ manager = get_manager_info
167
+ network = get_bmc_network
168
+
169
+ {
170
+ firmware_version: manager["FirmwareVersion"],
171
+ redfish_version: service_root["RedfishVersion"],
172
+ mac_address: network["mac_address"],
173
+ ip_address: network["ipv4_address"],
174
+ hostname: network["hostname"],
175
+ health: manager.dig("Status", "Health") || "OK"
176
+ }
141
177
  end
142
178
 
143
179
  def cpus
@@ -424,6 +460,17 @@ module Radfish
424
460
  info["Boot"] || {}
425
461
  end
426
462
 
463
+ def boot_options
464
+ boot = boot_config
465
+ {
466
+ "boot_source_override_enabled" => boot["BootSourceOverrideEnabled"],
467
+ "boot_source_override_target" => boot["BootSourceOverrideTarget"],
468
+ "boot_source_override_mode" => boot["BootSourceOverrideMode"],
469
+ "boot_order" => boot["BootOrder"],
470
+ "allowed_targets" => boot["BootSourceOverrideTarget@Redfish.AllowableValues"]
471
+ }
472
+ end
473
+
427
474
  def set_boot_override(target, persistent: false)
428
475
  enabled = persistent ? "Continuous" : "Once"
429
476
  payload = {
@@ -790,6 +837,26 @@ module Radfish
790
837
  {}
791
838
  end
792
839
  end
840
+
841
+ def get_manager_info
842
+ response = authenticated_request(:get, "/redfish/v1/Managers/#{MANAGER_ID}")
843
+ if response.status == 200
844
+ JSON.parse(response.body)
845
+ else
846
+ {}
847
+ end
848
+ end
849
+
850
+ def service_root
851
+ @service_root ||= begin
852
+ response = authenticated_request(:get, "/redfish/v1")
853
+ if response.status == 200
854
+ JSON.parse(response.body)
855
+ else
856
+ {}
857
+ end
858
+ end
859
+ end
793
860
  end
794
861
 
795
862
  # Register the AMI adapter
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radfish-ami
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel