radfish-ami 0.1.1 → 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: 608cd215eb2737b14e8b70fb3913d073f2c5f406bffc5e74ed677d666887a584
4
- data.tar.gz: e2368da6325353ec947e41878225faddf95d7f49f3363f24ba0a5de5ef500689
3
+ metadata.gz: 0b9d6c1504f5b0420021db42cf51f92f4864b57e829ab2167526758889f42a0a
4
+ data.tar.gz: 23b729993a4fd05476a6737f2b7eed8d21c6d4b297f850ea5b5dda35659897c8
5
5
  SHA512:
6
- metadata.gz: e9ba0414ebb9ed2c1b9c18b72e6363406c90bf4c1c4f8a47e87d14d150cf8bb713bfbb8137c089efe0a5b386276fbf70275ca76d090e71138d03e16597530dc5
7
- data.tar.gz: 5a92b6d8b65edf1db1c0af7f84c3c1153c9dbeec8d8db8d1c3163e68c958d10db451e366c7a5b08b39c18044ad87d9b5530ca046eb82469be9d5e0b2aae73fac
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.1"
5
+ VERSION = "0.1.4"
6
6
  end
7
7
  end
@@ -135,6 +135,47 @@ module Radfish
135
135
  system_info["SerialNumber"]
136
136
  end
137
137
 
138
+ def system_health
139
+ info = system_info
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
+ }
177
+ end
178
+
138
179
  def cpus
139
180
  response = authenticated_request(:get, "/redfish/v1/Systems/#{SYSTEM_ID}/Processors")
140
181
  return [] unless response.status == 200
@@ -419,6 +460,17 @@ module Radfish
419
460
  info["Boot"] || {}
420
461
  end
421
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
+
422
474
  def set_boot_override(target, persistent: false)
423
475
  enabled = persistent ? "Continuous" : "Once"
424
476
  payload = {
@@ -785,6 +837,26 @@ module Radfish
785
837
  {}
786
838
  end
787
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
788
860
  end
789
861
 
790
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.1
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel