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 +4 -4
- data/lib/radfish/ami/version.rb +1 -1
- data/lib/radfish/ami_adapter.rb +68 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b9d6c1504f5b0420021db42cf51f92f4864b57e829ab2167526758889f42a0a
|
|
4
|
+
data.tar.gz: 23b729993a4fd05476a6737f2b7eed8d21c6d4b297f850ea5b5dda35659897c8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa22eff985917551a7b889041c667f888b82dcc07c8f6dd95303c5b46c7d79152aa785bf9b3f01a22ffe4deb8683fb8a4d3486add7541e2fb51e3be658087cef
|
|
7
|
+
data.tar.gz: 94b80ed7c35a5bbf43d8f4ee73f5b988e34f8d95a7932ed6df295241d595aa941d2df896d4f670a71c516cebbc4000fde21a7d67c6357bbdc01128d8098688ff
|
data/lib/radfish/ami/version.rb
CHANGED
data/lib/radfish/ami_adapter.rb
CHANGED
|
@@ -137,7 +137,43 @@ module Radfish
|
|
|
137
137
|
|
|
138
138
|
def system_health
|
|
139
139
|
info = system_info
|
|
140
|
-
|
|
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
|