idrac 0.5.3 → 0.5.5

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: '08c0c927c8906901064229e84e01071445c5cb43d8e27146f53d9adc2084f2c3'
4
- data.tar.gz: a81b63a1c90c5a545abd1d2ea0f45dc50be607f023fb3c881b4611af6f670ebf
3
+ metadata.gz: 905a49888753b1dcfe826181f2a758083ef39a0964afefac2358ff17474645aa
4
+ data.tar.gz: e45f1e19020802027765730e0903cd57191964d0d6d14638a919f1da0dec8ae0
5
5
  SHA512:
6
- metadata.gz: 12073234311cbf0078aaa386d4c27214b3e467ca46065d2bfbb0f9a23e0a26bb587145738bccbcce006d51aef14de4910ae0201d38cc846a21804a8a52278bde
7
- data.tar.gz: 17612a2c01808f249bdcbe1e587804a299df1d16512965d032f2b574a88071937c2ac9ccf9e36b71ca11545cb7736b72e9bb4723154351f8812be937889455a9
6
+ metadata.gz: 5f09916115ddf02707df2f193eef9e0e7172a92c8fce94a1960002fed7429aa0bc4802d31074c3684e93404ea7c21de20a314340359a17b634c9db83b4590625
7
+ data.tar.gz: aeb4bea7d57908961898095dbf38c934f2178d42785b8ce630aaf0c6ebf6fe1d6b6c83f3e8b615ca28797c196e938a4a83f2c4a0e8c83fa152976891308d6c18
data/bin/idrac CHANGED
@@ -557,10 +557,10 @@ module IDRAC
557
557
  with_idrac_client do |client|
558
558
  controller = client.controller
559
559
  puts "\nStorage Controller Summary:".green.bold
560
- puts "Name: #{controller['Name']}".cyan
561
- puts "Model: #{controller['Model']}".cyan
562
- puts "Health: #{controller['Status']['Health']}".cyan
563
- puts "Manufacturer: #{controller['Manufacturer']}".cyan
560
+ puts "Name: #{controller.name}".cyan
561
+ puts "Model: #{controller.model}".cyan
562
+ puts "Health: #{controller.status&.health || 'Unknown'}".cyan
563
+ puts "Manufacturer: #{controller.manufacturer}".cyan
564
564
 
565
565
  if client.controller_encryption_capable?(controller)
566
566
  puts "Encryption Capable: Yes".green
@@ -581,17 +581,17 @@ module IDRAC
581
581
  puts "-" * 80
582
582
 
583
583
  controllers.each do |controller|
584
- puts "Controller: #{controller[:name]}".cyan.bold
585
- puts " Model: #{controller[:model]}"
586
- puts " Status: #{controller[:status]}"
587
- puts " Drives: #{controller[:drives_count]}"
588
- puts " Firmware: #{controller[:firmware_version]}"
589
- puts " Type: #{controller[:controller_type]}"
590
- puts " PCI Slot: #{controller[:pci_slot]}"
584
+ puts "Controller: #{controller.name}".cyan.bold
585
+ puts " Model: #{controller.model}"
586
+ puts " Status: #{controller.status}"
587
+ puts " Drives: #{controller.drives_count}"
588
+ puts " Firmware: #{controller.firmware_version}"
589
+ puts " Type: #{controller.controller_type}"
590
+ puts " PCI Slot: #{controller.pci_slot}"
591
591
 
592
- if controller[:encryption_capability]
593
- puts " Encryption: #{controller[:encryption_capability]}"
594
- puts " Encryption Mode: #{controller[:encryption_mode] || 'Disabled'}"
592
+ if controller.encryption_capability
593
+ puts " Encryption: #{controller.encryption_capability}"
594
+ puts " Encryption Mode: #{controller.encryption_mode || 'Disabled'}"
595
595
  end
596
596
 
597
597
  puts
@@ -610,17 +610,17 @@ module IDRAC
610
610
 
611
611
  puts "\nPhysical Drives (#{drives.size}):".green.bold
612
612
  drives.each do |drive|
613
- capacity_gb = drive[:capacity_bytes].to_f / (1024**3)
614
- health_color = drive[:health] == "OK" ? :green : :red
613
+ capacity_gb = drive.capacity_bytes.to_f / (1024**3)
614
+ health_color = drive.health == "OK" ? :green : :red
615
615
 
616
- puts "#{drive[:name]}:".bold
617
- puts " Model: #{drive[:model]}".cyan
618
- puts " Health: #{drive[:health].send(health_color)}"
616
+ puts "#{drive.name}:".bold
617
+ puts " Model: #{drive.model}".cyan
618
+ puts " Health: #{drive.health.send(health_color)}"
619
619
  puts " Capacity: #{capacity_gb.round(2)} GB".cyan
620
- puts " Media Type: #{drive[:media_type]}".cyan
621
- puts " Serial: #{drive[:serial]}".cyan
622
- if drive[:encryption_ability]
623
- puts " Encryption: #{drive[:encryption_ability]}".cyan
620
+ puts " Media Type: #{drive.media_type}".cyan
621
+ puts " Serial: #{drive.serial}".cyan
622
+ if drive.encryption_ability
623
+ puts " Encryption: #{drive.encryption_ability}".cyan
624
624
  end
625
625
  puts ""
626
626
  end
@@ -675,7 +675,7 @@ module IDRAC
675
675
  confirmation = $stdin.gets.chomp.downcase
676
676
 
677
677
  if confirmation == 'y'
678
- client.create_virtual_disk(controller['Id'], drives, name: options[:name], raid_type: options[:raid])
678
+ client.create_virtual_disk(controller.odata_id, drives, name: options[:name], raid_type: options[:raid])
679
679
  puts "Volume created successfully".green
680
680
  else
681
681
  puts "Operation cancelled".yellow
@@ -763,7 +763,7 @@ module IDRAC
763
763
  # Get keyid if not provided
764
764
  keyid = options[:keyid] || "RAID-Key-#{Time.now.strftime('%Y%m%d')}"
765
765
 
766
- client.enable_local_key_management(controller['Id'], passphrase: passphrase, keyid: keyid)
766
+ client.enable_local_key_management(controller.odata_id, passphrase: passphrase, keyid: keyid)
767
767
  puts "Encryption enabled successfully".green
768
768
  end
769
769
  end
@@ -784,7 +784,7 @@ module IDRAC
784
784
  confirmation = $stdin.gets.chomp
785
785
 
786
786
  if confirmation == 'DISABLE'
787
- client.disable_local_key_management(controller['Id'])
787
+ client.disable_local_key_management(controller.odata_id)
788
788
  puts "Encryption disabled successfully".green
789
789
  else
790
790
  puts "Operation cancelled".yellow
@@ -1262,7 +1262,7 @@ module IDRAC
1262
1262
  puts "\n[TEST] Storage management".cyan.bold
1263
1263
  begin
1264
1264
  controller = client.controller
1265
- puts "✓ Storage controller: #{controller['Name']} (#{controller['Model']})".green
1265
+ puts "✓ Storage controller: #{controller.name} (#{controller.model})".green
1266
1266
 
1267
1267
  drives = client.drives(controller)
1268
1268
  puts "✓ Found #{drives.size} physical drives".green
data/lib/idrac/client.rb CHANGED
@@ -302,6 +302,33 @@ module IDRAC
302
302
  end
303
303
  end
304
304
 
305
+ def get_firmware_version
306
+ response = authenticated_request(:get, "/redfish/v1/Managers/iDRAC.Embedded.1?$select=FirmwareVersion")
307
+
308
+ if response.status == 200
309
+ begin
310
+ data = JSON.parse(response.body)
311
+ return data["FirmwareVersion"]
312
+ rescue JSON::ParserError
313
+ raise Error, "Failed to parse firmware version response: #{response.body}"
314
+ end
315
+ else
316
+ # Try again without the $select parameter for older firmware
317
+ response = authenticated_request(:get, "/redfish/v1/Managers/iDRAC.Embedded.1")
318
+
319
+ if response.status == 200
320
+ begin
321
+ data = JSON.parse(response.body)
322
+ return data["FirmwareVersion"]
323
+ rescue JSON::ParserError
324
+ raise Error, "Failed to parse firmware version response: #{response.body}"
325
+ end
326
+ else
327
+ raise Error, "Failed to get firmware version. Status code: #{response.status}"
328
+ end
329
+ end
330
+ end
331
+
305
332
  # Execute a block with automatic retries
306
333
  # @param max_retries [Integer] Maximum number of retry attempts
307
334
  # @param initial_delay [Integer] Initial delay in seconds between retries (increases exponentially)
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.3"
4
+ VERSION = "0.5.5"
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.3
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel