idrac 0.4.5 → 0.4.6

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: ffcb1d99822a0e7d0015f018b6967e3977d7506438a3e2d917e0615f281aa0e3
4
- data.tar.gz: 188a912ccdcdb5712ead6b5f181d59902f9b50718e3c3e39e2949f6fbc7ad606
3
+ metadata.gz: 7df39736fab2faa7b64224202408ac4a96034c0b2d8f21999b4c20a93f1e0bdf
4
+ data.tar.gz: 79d5162af8bb949440c2b10a3e1d7b5504ed982122595e4263c9da30128cb4f1
5
5
  SHA512:
6
- metadata.gz: dfd1714f7a86b37991a7493be186043be14a400f6e36d7712c366c1007857eee7eb4ece8390187a56f7faa921f46ffdf9ad1250ff471daf3ad2ccd884c14cda2
7
- data.tar.gz: 20d5a051050da7a5b75d08529d16e2806af72ac05161393dd1a5cca509f17b2ec497f7a9b2f9c3f0933af72394b81696ae88b48736b6de67bd8ab7ae43319b25
6
+ metadata.gz: 64265ea0635c641ec072bd3b6737c9e706998507dbffd6c28c3f364576655101412fadfedb9aa3aa9997957f95d85e9649c1a7c2cc5ed661935334ab556ceb0a
7
+ data.tar.gz: 3b758f2a38ec01b9c07812ed3464b603c77ee258411d74fb5e97f29183bbcec25cee29119a0e3a7e30fc2ef6fd76ec950938487731d04d3aa99c72babf0a08ba
data/README.md CHANGED
@@ -15,6 +15,7 @@ A Ruby client for the Dell iDRAC API. This gem provides a command-line interface
15
15
  - Job queue management (clear, monitor, list)
16
16
  - Lifecycle log and System Event Log (SEL) management
17
17
  - Lifecycle Controller status management
18
+ - Return values as RecursiveOpenStruct objects for convenient attribute access
18
19
 
19
20
  ## Installation
20
21
 
@@ -170,6 +171,25 @@ client.clear_lifecycle!
170
171
  # Clear System Event Logs
171
172
  client.clear_system_event_logs!
172
173
 
174
+ # Working with RecursiveOpenStruct objects
175
+ # Many methods return data as RecursiveOpenStruct objects for easier property access
176
+
177
+ # Get memory information
178
+ memory_modules = client.memory
179
+ memory_modules.each do |dimm|
180
+ # Access properties directly as methods
181
+ puts "#{dimm.name}: #{dimm.capacity_bytes / (1024**3)}GB, Speed: #{dimm.speed_mhz}MHz"
182
+ end
183
+
184
+ # Get storage information
185
+ controller = client.controller
186
+ volumes = client.volumes(controller)
187
+ volumes.each do |volume|
188
+ # Access properties via dot notation
189
+ puts "#{volume.name} (#{volume.raid_level}): #{volume.capacity_bytes / (1024**3)}GB"
190
+ puts " Health: #{volume.health}, FastPath: #{volume.fastpath}"
191
+ end
192
+
173
193
  # Create a client with auto_delete_sessions disabled
174
194
  client = IDRAC.new(
175
195
  host: '192.168.1.100',
@@ -187,6 +207,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
187
207
 
188
208
  ## Changelog
189
209
 
210
+ ### Version 0.1.40
211
+ - **Enhanced Return Values**: Methods that return system components now provide RecursiveOpenStruct objects
212
+ - Memory, drives, volumes, PSUs, and fans now support convenient dot notation for attribute access
213
+ - Improved object structure with consistent property naming across different component types
214
+ - Better code organization and readability when working with returned objects
215
+
190
216
  ### Version 0.1.39
191
217
  - **Added Job Management**: New methods for managing iDRAC jobs
192
218
  - List jobs using `jobs` and `jobs_detail`
data/bin/idrac CHANGED
@@ -1103,6 +1103,28 @@ module IDRAC
1103
1103
  end
1104
1104
  end
1105
1105
 
1106
+ desc "system_info", "Get detailed system identification information"
1107
+ map "system:info" => :system_info
1108
+ def system_info
1109
+ with_idrac_client do |client|
1110
+ info = client.system_info
1111
+
1112
+ if info[:is_dell]
1113
+ puts "Dell iDRAC System:".green.bold
1114
+ puts " Service Tag: #{info[:service_tag]}".cyan
1115
+ puts " Model: #{info[:model]}".cyan
1116
+ puts " iDRAC Version: #{info[:idrac_version]}".cyan
1117
+ puts " Firmware Version: #{info[:firmware_version]}".cyan
1118
+ else
1119
+ puts "Not a Dell iDRAC system".yellow
1120
+ puts " Product: #{info[:product]}".cyan
1121
+ if info[:is_ancient_dell]
1122
+ puts " Ancient Dell System detected. Update firmware.".yellow
1123
+ end
1124
+ end
1125
+ end
1126
+ end
1127
+
1106
1128
  # Test commands
1107
1129
  desc "test_live", "Test all major functionality of the gem on a real system"
1108
1130
  map "test:live" => :test_live
data/lib/idrac/system.rb CHANGED
@@ -332,6 +332,67 @@ module IDRAC
332
332
  return nics_with_pci
333
333
  end
334
334
 
335
+ # Get system identification information
336
+ def system_info
337
+ response = authenticated_request(:get, "/redfish/v1")
338
+
339
+ if response.status == 200
340
+ begin
341
+ data = JSON.parse(response.body)
342
+
343
+ # Initialize return hash with defaults
344
+ info = {
345
+ is_dell: false,
346
+ is_ancient_dell: false,
347
+ product: data["Product"] || "Unknown",
348
+ service_tag: nil,
349
+ model: nil,
350
+ idrac_version: data["RedfishVersion"],
351
+ firmware_version: nil
352
+ }
353
+
354
+ # Check if it's a Dell iDRAC
355
+ if data["Product"] == "Integrated Dell Remote Access Controller"
356
+ info[:is_dell] = true
357
+
358
+ # Get service tag from Dell OEM data
359
+ info[:service_tag] = data.dig("Oem", "Dell", "ServiceTag")
360
+
361
+ # Get firmware version - try both common locations
362
+ info[:firmware_version] = data["FirmwareVersion"] || data.dig("Oem", "Dell", "FirmwareVersion")
363
+
364
+ # Get additional system information
365
+ system_response = authenticated_request(:get, "/redfish/v1/Systems/System.Embedded.1")
366
+ if system_response.status == 200
367
+ system_data = JSON.parse(system_response.body)
368
+ info[:model] = system_data["Model"]
369
+ end
370
+ else
371
+ # Check if it's an older Dell model
372
+ begin
373
+ chassis_response = authenticated_request(:get, "/redfish/v1/Chassis/System.Embedded.1")
374
+ if chassis_response.status == 200
375
+ chassis_data = JSON.parse(chassis_response.body)
376
+ if chassis_data["Manufacturer"] && chassis_data["Manufacturer"].include?("Dell")
377
+ info[:is_ancient_dell] = true
378
+ info[:model] = chassis_data["Model"]
379
+ info[:service_tag] = chassis_data["SKU"] || chassis_data["SerialNumber"]
380
+ end
381
+ end
382
+ rescue
383
+ # Ignore errors while checking for ancient Dell
384
+ end
385
+ end
386
+
387
+ return info
388
+ rescue JSON::ParserError
389
+ raise Error, "Failed to parse system info response: #{response.body}"
390
+ end
391
+ else
392
+ raise Error, "Failed to get system info. Status code: #{response.status}"
393
+ end
394
+ end
395
+
335
396
  # Get system event logs
336
397
  def system_event_logs
337
398
  response = authenticated_request(:get, "/redfish/v1/Managers/iDRAC.Embedded.1/Logs/Sel?$expand=*($levels=1)")
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.4.5"
4
+ VERSION = "0.4.6"
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.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel