idrac 0.1.29 → 0.1.31
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/README.md +34 -1
- data/bin/idrac +38 -36
- data/dell_firmware_downloads/Catalog.etag +1 -0
- data/dell_firmware_downloads/Catalog.xml +0 -0
- data/idrac-0.1.6/.rspec +3 -0
- data/idrac-0.1.6/README.md +103 -0
- data/idrac-0.1.6/Rakefile +17 -0
- data/idrac-0.1.6/bin/console +11 -0
- data/idrac-0.1.6/bin/idrac +179 -0
- data/idrac-0.1.6/bin/setup +8 -0
- data/idrac-0.1.6/idrac.gemspec +51 -0
- data/idrac-0.1.6/lib/idrac/client.rb +109 -0
- data/idrac-0.1.6/lib/idrac/firmware.rb +366 -0
- data/idrac-0.1.6/lib/idrac/version.rb +5 -0
- data/idrac-0.1.6/lib/idrac.rb +30 -0
- data/idrac-0.1.6/sig/idrac.rbs +4 -0
- data/idrac-0.1.7/.rspec +3 -0
- data/idrac-0.1.7/README.md +103 -0
- data/idrac-0.1.7/Rakefile +17 -0
- data/idrac-0.1.7/bin/console +11 -0
- data/idrac-0.1.7/bin/idrac +179 -0
- data/idrac-0.1.7/bin/setup +8 -0
- data/idrac-0.1.7/idrac.gemspec +51 -0
- data/idrac-0.1.7/lib/idrac/client.rb +109 -0
- data/idrac-0.1.7/lib/idrac/firmware.rb +366 -0
- data/idrac-0.1.7/lib/idrac/screenshot.rb +49 -0
- data/idrac-0.1.7/lib/idrac/version.rb +5 -0
- data/idrac-0.1.7/lib/idrac.rb +30 -0
- data/idrac-0.1.7/sig/idrac.rbs +4 -0
- data/idrac.gemspec +1 -0
- data/idrac.py +500 -0
- data/lib/idrac/client.rb +206 -144
- data/lib/idrac/firmware.rb +401 -228
- data/lib/idrac/firmware_catalog.rb +32 -31
- data/lib/idrac/version.rb +1 -1
- data/test_firmware_update.rb +27 -29
- data/updater.rb +729 -0
- metadata +44 -1
@@ -2,10 +2,13 @@ require 'net/http'
|
|
2
2
|
require 'uri'
|
3
3
|
require 'fileutils'
|
4
4
|
require 'nokogiri'
|
5
|
+
require 'open-uri'
|
6
|
+
require 'colorize'
|
5
7
|
|
6
8
|
module IDRAC
|
7
9
|
class FirmwareCatalog
|
8
|
-
|
10
|
+
DELL_CATALOG_BASE = 'https://downloads.dell.com'
|
11
|
+
DELL_CATALOG_URL = "#{DELL_CATALOG_BASE}/catalog/Catalog.xml.gz"
|
9
12
|
|
10
13
|
attr_reader :catalog_path
|
11
14
|
|
@@ -14,40 +17,38 @@ module IDRAC
|
|
14
17
|
end
|
15
18
|
|
16
19
|
def download(output_dir = nil)
|
17
|
-
#
|
18
|
-
output_dir ||= File.expand_path(
|
20
|
+
# Default to ~/.idrac directory
|
21
|
+
output_dir ||= File.expand_path('~/.idrac')
|
19
22
|
FileUtils.mkdir_p(output_dir) unless Dir.exist?(output_dir)
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
puts "Downloading Dell catalog from #{CATALOG_URL}..."
|
25
|
-
|
26
|
-
uri = URI.parse(CATALOG_URL)
|
27
|
-
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
28
|
-
request = Net::HTTP::Get.new(uri)
|
29
|
-
http.request(request) do |response|
|
30
|
-
if response.code == "200"
|
31
|
-
File.open(catalog_gz_path, 'wb') do |file|
|
32
|
-
response.read_body do |chunk|
|
33
|
-
file.write(chunk)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
else
|
37
|
-
raise Error, "Failed to download catalog: #{response.code} #{response.message}"
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
24
|
+
catalog_gz = File.join(output_dir, 'Catalog.xml.gz')
|
25
|
+
catalog_xml = File.join(output_dir, 'Catalog.xml')
|
41
26
|
|
42
|
-
puts "
|
43
|
-
system("gunzip -f #{catalog_gz_path}")
|
27
|
+
puts "Downloading Dell catalog from #{DELL_CATALOG_URL}...".light_cyan
|
44
28
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
29
|
+
begin
|
30
|
+
# Download the catalog
|
31
|
+
URI.open(DELL_CATALOG_URL) do |remote_file|
|
32
|
+
File.open(catalog_gz, 'wb') do |local_file|
|
33
|
+
local_file.write(remote_file.read)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
puts "Extracting catalog...".light_cyan
|
38
|
+
|
39
|
+
# Extract the catalog
|
40
|
+
system("gunzip -f #{catalog_gz}")
|
41
|
+
|
42
|
+
if File.exist?(catalog_xml)
|
43
|
+
puts "Catalog downloaded and extracted to #{catalog_xml}".green
|
44
|
+
@catalog_path = catalog_xml
|
45
|
+
return catalog_xml
|
46
|
+
else
|
47
|
+
raise Error, "Failed to extract catalog"
|
48
|
+
end
|
49
|
+
rescue => e
|
50
|
+
puts "Error downloading catalog: #{e.message}".red.bold
|
51
|
+
raise Error, "Failed to download Dell catalog: #{e.message}"
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
data/lib/idrac/version.rb
CHANGED
data/test_firmware_update.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
3
|
+
require 'lib/idrac'
|
4
|
+
require 'colorize'
|
4
5
|
|
5
6
|
# Create a client
|
6
7
|
client = IDRAC::Client.new(
|
@@ -12,59 +13,56 @@ client = IDRAC::Client.new(
|
|
12
13
|
|
13
14
|
begin
|
14
15
|
# Login to iDRAC
|
16
|
+
puts "Logging in to iDRAC...".light_cyan
|
15
17
|
client.login
|
16
|
-
puts "Logged in successfully"
|
18
|
+
puts "Logged in successfully".green
|
17
19
|
|
18
20
|
# Create a firmware instance
|
19
21
|
firmware = IDRAC::Firmware.new(client)
|
20
22
|
|
21
23
|
# Get system inventory
|
22
|
-
puts "Getting system inventory..."
|
24
|
+
puts "Getting system inventory...".light_cyan
|
23
25
|
inventory = firmware.get_system_inventory
|
24
26
|
|
25
|
-
puts "System Information:"
|
26
|
-
puts " Model: #{inventory[:system][:model]}"
|
27
|
-
puts " Manufacturer: #{inventory[:system][:manufacturer]}"
|
28
|
-
puts " Service Tag: #{inventory[:system][:service_tag]}"
|
29
|
-
puts " BIOS Version: #{inventory[:system][:bios_version]}"
|
27
|
+
puts "System Information:".green.bold
|
28
|
+
puts " Model: #{inventory[:system][:model]}".light_cyan
|
29
|
+
puts " Manufacturer: #{inventory[:system][:manufacturer]}".light_cyan
|
30
|
+
puts " Service Tag: #{inventory[:system][:service_tag]}".light_cyan
|
31
|
+
puts " BIOS Version: #{inventory[:system][:bios_version]}".light_cyan
|
30
32
|
|
31
|
-
puts "\nInstalled Firmware:"
|
33
|
+
puts "\nInstalled Firmware:".green.bold
|
32
34
|
inventory[:firmware].each do |fw|
|
33
|
-
puts " #{fw[:name]}: #{fw[:version]} (#{fw[:updateable] ? 'Updateable' : 'Not Updateable'})"
|
35
|
+
puts " #{fw[:name]}: #{fw[:version]} (#{fw[:updateable] ? 'Updateable'.light_green : 'Not Updateable'.light_red})".light_cyan
|
34
36
|
end
|
35
37
|
|
36
38
|
# Check for updates
|
37
39
|
catalog_path = File.expand_path("~/.idrac/Catalog.xml")
|
38
40
|
if File.exist?(catalog_path)
|
39
|
-
puts "\nChecking for updates using catalog: #{catalog_path}"
|
41
|
+
puts "\nChecking for updates using catalog: #{catalog_path}".light_cyan
|
40
42
|
updates = firmware.check_updates(catalog_path)
|
41
43
|
|
42
|
-
if updates.
|
43
|
-
puts "
|
44
|
-
else
|
45
|
-
puts "\nAvailable Updates:"
|
44
|
+
if updates.any?
|
45
|
+
puts "\nAvailable Updates:".green.bold
|
46
46
|
updates.each_with_index do |update, index|
|
47
|
-
puts "#{index + 1}. #{update[:name]}: #{update[:current_version]} -> #{update[:available_version]}"
|
47
|
+
puts "#{index + 1}. #{update[:name]}: #{update[:current_version]} -> #{update[:available_version]}".light_cyan
|
48
48
|
end
|
49
49
|
|
50
|
-
#
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
firmware.interactive_update(catalog_path, [selected_update])
|
58
|
-
end
|
50
|
+
# Interactive update for the first update
|
51
|
+
puts "\nSelected update: #{updates.first[:name]}".light_yellow
|
52
|
+
puts "Starting interactive update for selected component...".light_cyan.bold
|
53
|
+
|
54
|
+
firmware.interactive_update(catalog_path, [updates.first])
|
55
|
+
else
|
56
|
+
puts "No updates available for your system.".yellow
|
59
57
|
end
|
60
58
|
else
|
61
|
-
puts "\nCatalog
|
59
|
+
puts "\nCatalog not found at #{catalog_path}. Run 'idrac firmware:catalog' to download it.".yellow
|
62
60
|
end
|
63
61
|
|
64
62
|
rescue IDRAC::Error => e
|
65
|
-
puts "Error: #{e.message}"
|
63
|
+
puts "Error: #{e.message}".red.bold
|
66
64
|
ensure
|
67
65
|
# Logout
|
68
|
-
client.logout if client
|
69
|
-
puts "Logged out"
|
66
|
+
client.logout if client
|
67
|
+
puts "Logged out".light_cyan
|
70
68
|
end
|