idrac 0.5.0 → 0.5.2

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: 32086f37bcf1f9d8bfaf3bf5a54e4159cc2db5ed3b97bc5021203f266e62e7aa
4
- data.tar.gz: c107965b24d8edc018f44c42da5f6ddd978d978a4ed83eea51304e7b80dc5f40
3
+ metadata.gz: e1bffe050d6256766e75d7a51d80133d14c3b86abcfc53b1de4e172be80f4747
4
+ data.tar.gz: c74c883203a6b14e2f18041c7df0e4dacae125cbf6f6cc6a3da2a0dd1bc56ef6
5
5
  SHA512:
6
- metadata.gz: 45d74e3ba6b18f6a86e6f644932a20b4316814814a4c37961b54092f6bfe018bfbadc3d9cade70c160dd43c7adb80d7e86e30468e88152a32631b0883b94e09d
7
- data.tar.gz: b84528baa1d901c687107ea00dc08a1668ad5f60d258cbfb0f9fc69bcbe5efa6530d5c9c2614270f7c3044dd2cd99665168b7f6eadab53d2c4d7b17b1a88fb33
6
+ metadata.gz: db7644ef1fd92b3af97d0c202d5e3b6d80963bb5ecbe24b4a339249184c29667e7e0dea3f7e99074afaa52af127ef249c9768cf322156a12769a230d7cee7b76
7
+ data.tar.gz: 63e817a2e85d68f3c848658adefe7567ebd629546b15362d7ac32c9cb19aea4edd54f5091bf893f38a8f52c84eaa9c6ffda07b71fb4abc8872fde4bf74959961
data/bin/idrac CHANGED
@@ -463,11 +463,11 @@ module IDRAC
463
463
  license = client.license_info
464
464
  if license
465
465
  puts "\nLicense Information:".green.bold
466
- puts "Description: #{license['Description']}".cyan
467
- puts "License Type: #{license['LicenseType']}".cyan
466
+ puts "Description: #{license.Description}".cyan
467
+ puts "License Type: #{license.LicenseType}".cyan
468
468
  puts "License Version: #{client.license_version || 'Unknown'}".cyan
469
- puts "Removable: #{license['Removable']}".cyan
470
- puts "Status: #{license.dig('Status', 'Health') || 'Unknown'}".cyan
469
+ puts "Removable: #{license.Removable}".cyan
470
+ puts "Status: #{license&.Status&.Health || 'Unknown'}".cyan
471
471
  else
472
472
  puts "No license information available".yellow
473
473
  end
@@ -906,13 +906,13 @@ module IDRAC
906
906
  puts "\nProcessor Summary:".green.bold
907
907
  puts "=" * 50
908
908
 
909
- health_color = cpus[:status] == "OK" ? :green : :red
909
+ health_color = cpus.status == "OK" ? :green : :red
910
910
 
911
- puts "Processor Model:".ljust(25) + cpus[:model].to_s.light_cyan
912
- puts "Processor Count:".ljust(25) + cpus[:count].to_s.light_cyan
913
- puts "Physical Cores:".ljust(25) + cpus[:cores].to_s.light_cyan
914
- puts "Logical Cores:".ljust(25) + cpus[:threads].to_s.light_cyan
915
- puts "Status:".ljust(25) + cpus[:status].to_s.send(health_color)
911
+ puts "Processor Model:".ljust(25) + cpus.model.to_s.light_cyan
912
+ puts "Processor Count:".ljust(25) + cpus.count.to_s.light_cyan
913
+ puts "Physical Cores:".ljust(25) + cpus.cores.to_s.light_cyan
914
+ puts "Logical Cores:".ljust(25) + cpus.threads.to_s.light_cyan
915
+ puts "Status:".ljust(25) + cpus.status.to_s.send(health_color)
916
916
 
917
917
  puts "=" * 50
918
918
  end
@@ -1164,16 +1164,16 @@ module IDRAC
1164
1164
  with_idrac_client do |client|
1165
1165
  info = client.system_info
1166
1166
 
1167
- if info[:is_dell]
1167
+ if info.is_dell
1168
1168
  puts "Dell iDRAC System:".green.bold
1169
- puts " Service Tag: #{info[:service_tag]}".cyan
1170
- puts " Model: #{info[:model]}".cyan
1171
- puts " iDRAC Version: #{info[:idrac_version]}".cyan
1172
- puts " Firmware Version: #{info[:firmware_version]}".cyan
1169
+ puts " Service Tag: #{info.service_tag}".cyan
1170
+ puts " Model: #{info.model}".cyan
1171
+ puts " iDRAC Version: #{info.idrac_version}".cyan
1172
+ puts " Firmware Version: #{info.firmware_version}".cyan
1173
1173
  else
1174
1174
  puts "Not a Dell iDRAC system".yellow
1175
- puts " Product: #{info[:product]}".cyan
1176
- if info[:is_ancient_dell]
1175
+ puts " Product: #{info.product}".cyan
1176
+ if info.is_ancient_dell
1177
1177
  puts " Ancient Dell System detected. Update firmware.".yellow
1178
1178
  end
1179
1179
  end
@@ -1204,17 +1204,17 @@ module IDRAC
1204
1204
  puts "=" * 50
1205
1205
 
1206
1206
  # Display overall health with color coding
1207
- overall_color = health[:overall] == "OK" ? :green : :red
1208
- system_color = health[:system] == "OK" ? :green : :red
1209
- processor_color = health[:processor] == "OK" ? :green : :red
1210
- memory_color = health[:memory] == "OK" ? :green : :red
1211
- storage_color = health[:storage] == "OK" ? :green : (health[:storage].nil? ? :yellow : :red)
1212
-
1213
- puts "Overall Health:".ljust(25) + health[:overall].to_s.send(overall_color)
1214
- puts "System Health:".ljust(25) + health[:system].to_s.send(system_color)
1215
- puts "Processor Health:".ljust(25) + health[:processor].to_s.send(processor_color)
1216
- puts "Memory Health:".ljust(25) + health[:memory].to_s.send(memory_color)
1217
- puts "Storage Health:".ljust(25) + (health[:storage] || "Unknown").to_s.send(storage_color)
1207
+ overall_color = health.overall == "OK" ? :green : :red
1208
+ system_color = health.system == "OK" ? :green : :red
1209
+ processor_color = health.processor == "OK" ? :green : :red
1210
+ memory_color = health.memory == "OK" ? :green : :red
1211
+ storage_color = health.storage == "OK" ? :green : (health.storage.nil? ? :yellow : :red)
1212
+
1213
+ puts "Overall Health:".ljust(25) + health.overall.to_s.send(overall_color)
1214
+ puts "System Health:".ljust(25) + health.system.to_s.send(system_color)
1215
+ puts "Processor Health:".ljust(25) + health.processor.to_s.send(processor_color)
1216
+ puts "Memory Health:".ljust(25) + health.memory.to_s.send(memory_color)
1217
+ puts "Storage Health:".ljust(25) + (health.storage || "Unknown").to_s.send(storage_color)
1218
1218
 
1219
1219
  puts "=" * 50
1220
1220
  end
data/lib/idrac/license.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module IDRAC
2
2
  module License
3
3
  # Gets the license information from the iDRAC
4
- # @return [Hash] License details
4
+ # @return [RecursiveOpenStruct] License details
5
5
  def license_info
6
6
  response = authenticated_request(:get, "/redfish/v1/LicenseService/Licenses")
7
7
  if response.status != 200
@@ -32,7 +32,7 @@ module IDRAC
32
32
  license_details = JSON.parse(license_response.body)
33
33
  debug "License details: #{license_details}", 2
34
34
 
35
- return license_details
35
+ return RecursiveOpenStruct.new(license_details, recurse_over_arrays: true)
36
36
  end
37
37
 
38
38
  # Extracts the iDRAC version from the license description
@@ -43,15 +43,15 @@ module IDRAC
43
43
 
44
44
  # Check the Description field, which often contains the version
45
45
  # Example: "iDRAC9 Enterprise License"
46
- if license["Description"] && license["Description"].match(/iDRAC(\d+)/i)
47
- version = license["Description"].match(/iDRAC(\d+)/i)[1].to_i
46
+ if license.Description && license.Description.match(/iDRAC(\d+)/i)
47
+ version = license.Description.match(/iDRAC(\d+)/i)[1].to_i
48
48
  debug "Found license version from Description: #{version}", 1
49
49
  return version
50
50
  end
51
51
 
52
52
  # Try alternative fields if Description didn't work
53
- if license["Name"] && license["Name"].match(/iDRAC(\d+)/i)
54
- version = license["Name"].match(/iDRAC(\d+)/i)[1].to_i
53
+ if license.Name && license.Name.match(/iDRAC(\d+)/i)
54
+ version = license.Name.match(/iDRAC(\d+)/i)[1].to_i
55
55
  debug "Found license version from Name: #{version}", 1
56
56
  return version
57
57
  end
data/lib/idrac/system.rb CHANGED
@@ -368,16 +368,16 @@ module IDRAC
368
368
  info[:model] = system_data["Model"]
369
369
  end
370
370
 
371
- return info
371
+ return RecursiveOpenStruct.new(info, recurse_over_arrays: true)
372
372
  else
373
373
  # Try to handle ancient Dell models where Product is null or non-standard
374
374
  if data["Product"].nil? || data.dig("Oem", "Dell")
375
375
  info[:is_ancient_dell] = true
376
- return info
376
+ return RecursiveOpenStruct.new(info, recurse_over_arrays: true)
377
377
  end
378
378
  end
379
379
 
380
- return info
380
+ return RecursiveOpenStruct.new(info, recurse_over_arrays: true)
381
381
  rescue JSON::ParserError
382
382
  raise Error, "Failed to parse system information: #{response.body}"
383
383
  end
@@ -402,7 +402,7 @@ module IDRAC
402
402
  status: data.dig("ProcessorSummary", "Status", "Health")
403
403
  }
404
404
 
405
- return summary
405
+ return RecursiveOpenStruct.new(summary, recurse_over_arrays: true)
406
406
  rescue JSON::ParserError
407
407
  raise Error, "Failed to parse processor information: #{response.body}"
408
408
  end
@@ -427,7 +427,7 @@ module IDRAC
427
427
  storage: data.dig("Storage", "Status", "Health")
428
428
  }
429
429
 
430
- return health
430
+ return RecursiveOpenStruct.new(health, recurse_over_arrays: true)
431
431
  rescue JSON::ParserError
432
432
  raise Error, "Failed to parse system health information: #{response.body}"
433
433
  end
data/lib/idrac/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IDRAC
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idrac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel