idrac 0.8.0 → 0.8.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: 58f8d5e0d7f90857359eaf0be71c114da11ac324539b335e1a55f21567c33020
4
- data.tar.gz: 498235abd52da11fba45a89032a5e0a72a56b53b7918e60bbdacfeda718229a2
3
+ metadata.gz: f05569a76e03f75c446229de12ff12a84b6d93a23256821e3fba8c43e2241a49
4
+ data.tar.gz: 25de5109e5e40914d50d7ded48a2e83fb42f93f1fe1a3fa1b83fdd307fe15c58
5
5
  SHA512:
6
- metadata.gz: 83010a42db5c2f04ce5d7c49802725e54aeb68409c2aaca00318fb32bb4c6adb69b50f22f2e2b14891934fd308b248d6b8169bcb70ba8e3f0415ea5405c3438a
7
- data.tar.gz: d9bea26cad955e27ad749018973d999e76741b34d0645f2cc7f9abc046f977ec95d23bebbb46a2e80f990bb71cc265c7b52b1ed539dee0a8463984efa66f1864
6
+ metadata.gz: d28f789451cddfaa2fbd31a24109f6a7517b4605a1604c70c37bba5cc9b73d10bd3f187fcdc5e934d55c06c966bcc7cacbad615ffadca6fb873d6e03af0284bf
7
+ data.tar.gz: 22b385944dd4abb637bdfea5f3383f9b853d6bd37ffa889fde70482802da163cdd20ef1f7580e7c54657aa900fbf9cbb8ef8e7199fcd0f4d4a985617f574c158
data/idrac.gemspec CHANGED
@@ -10,14 +10,14 @@ Gem::Specification.new do |spec|
10
10
 
11
11
  spec.summary = "API Client for Dell iDRAC"
12
12
  spec.description = "A Ruby client for the Dell iDRAC API"
13
- spec.homepage = "http://github.com"
13
+ spec.homepage = "https://github.com/buildio/idrac"
14
14
  spec.license = "MIT"
15
- spec.required_ruby_version = ">= 3.2.0" # Updated to support Ruby 3.2.x
15
+ spec.required_ruby_version = ">= 2.7.0"
16
16
 
17
17
  # spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'"
18
18
 
19
19
  spec.metadata["homepage_uri"] = spec.homepage
20
- # spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
20
+ spec.metadata["source_code_uri"] = "https://github.com/buildio/idrac"
21
21
  # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
@@ -41,7 +41,7 @@ Gem::Specification.new do |spec|
41
41
  spec.add_dependency "thor", "~> 1.2", ">= 1.2.0"
42
42
  spec.add_dependency "base64", "~> 0.1", ">= 0.1.0"
43
43
  spec.add_dependency "colorize", "~> 1.1", ">= 1.1.0"
44
- spec.add_dependency "activesupport", ">= 6.0", "< 8.1"
44
+ spec.add_dependency "activesupport", ">= 7.0"
45
45
 
46
46
  # Development dependencies
47
47
  spec.add_development_dependency "bundler", "~> 2.4", ">= 2.4.0"
@@ -57,7 +57,7 @@ module IDRAC
57
57
  puts "Retrieving system inventory..."
58
58
 
59
59
  # Get basic system information
60
- system_uri = URI.parse("#{client.base_url}/redfish/v1/Systems/System.Embedded.1")
60
+ # system_uri = URI.parse("#{client.base_url}/redfish/v1/Systems/System.Embedded.1") # Not used, kept for reference
61
61
  system_response = client.authenticated_request(:get, "/redfish/v1/Systems/System.Embedded.1")
62
62
 
63
63
  if system_response.status != 200
@@ -67,7 +67,7 @@ module IDRAC
67
67
  system_data = JSON.parse(system_response.body)
68
68
 
69
69
  # Get firmware inventory
70
- firmware_uri = URI.parse("#{client.base_url}/redfish/v1/UpdateService/FirmwareInventory")
70
+ # firmware_uri = URI.parse("#{client.base_url}/redfish/v1/UpdateService/FirmwareInventory") # Not used, kept for reference
71
71
  firmware_response = client.authenticated_request(:get, "/redfish/v1/UpdateService/FirmwareInventory")
72
72
 
73
73
  if firmware_response.status != 200
@@ -479,7 +479,7 @@ module IDRAC
479
479
  end
480
480
 
481
481
  # Upload the firmware file
482
- file_content = File.read(firmware_path)
482
+ # file_content = File.read(firmware_path) # Not used directly, file is read by Faraday
483
483
 
484
484
  headers = {
485
485
  'Content-Type' => 'multipart/form-data',
data/lib/idrac/power.rb CHANGED
@@ -152,6 +152,14 @@ module IDRAC
152
152
  JSON.parse(handle_response(response))&.dig("PowerControl", 0, "PowerConsumedWatts")&.to_f
153
153
  end
154
154
 
155
+ # TODO: Migrate method names to match radfish interface for uniformity:
156
+ # - Rename get_power_usage_watts to power_consumption_watts
157
+ # - Rename get_power_state to power_status
158
+ # - Ensure all methods return consistent types across vendors
159
+ # Once all vendor gems conform to the same interface, the radfish adapters
160
+ # can become thin registration layers or be eliminated entirely.
161
+ alias_method :power_consumption_watts, :get_power_usage_watts
162
+
155
163
  private
156
164
 
157
165
  def wait_for_power_state(target_state:, tries: 6)
data/lib/idrac/storage.rb CHANGED
@@ -212,7 +212,7 @@ module IDRAC
212
212
  if controller_comp
213
213
  # Try to find the matching virtual disk
214
214
  # Format is typically "Disk.Virtual.X:RAID...."
215
- vd_name = vol["Id"] || vol["Name"]
215
+ # vd_name = vol["Id"] || vol["Name"] # Not used, kept for debugging
216
216
  vd_comp = controller_comp["Components"]&.find do |comp|
217
217
  comp["FQDD"] =~ /Disk\.Virtual\.\d+:#{controller_fqdd}/
218
218
  end
data/lib/idrac/system.rb CHANGED
@@ -142,7 +142,7 @@ module IDRAC
142
142
  end
143
143
  end
144
144
  end
145
- rescue => e
145
+ rescue
146
146
  # Ignore errors, just continue
147
147
  end
148
148
 
@@ -152,7 +152,7 @@ module IDRAC
152
152
  if idrac_net && idrac_net["mac"] && idrac_net["ipv4"]
153
153
  nic_ip_map[idrac_net["mac"].upcase] = idrac_net["ipv4"]
154
154
  end
155
- rescue => e
155
+ rescue
156
156
  # Ignore errors, just continue
157
157
  end
158
158
 
@@ -218,7 +218,7 @@ module IDRAC
218
218
  break
219
219
  end
220
220
  end
221
- rescue => e
221
+ rescue
222
222
  # Ignore errors and try the next port type
223
223
  end
224
224
  end
@@ -775,7 +775,7 @@ module IDRAC
775
775
 
776
776
  # Try to get license information (new approach that works with iDRAC 8 too)
777
777
  license_info = license_info() rescue nil
778
- license_version = license_version() rescue nil
778
+ # license_version = license_version() rescue nil # Not used currently
779
779
 
780
780
  if license_info
781
781
  license_type = license_info["LicenseType"] || "Unknown"
@@ -819,4 +819,4 @@ module IDRAC
819
819
  end
820
820
  end
821
821
  end
822
- end
822
+ end
data/lib/idrac/utility.rb CHANGED
@@ -374,7 +374,7 @@ module IDRAC
374
374
  break
375
375
  end
376
376
  sleep 30
377
- rescue => e
377
+ rescue
378
378
  tries += 1
379
379
  if tries > 5
380
380
  debug "Failed to reconnect to iDRAC after 5 attempts", 1, :red
@@ -395,7 +395,7 @@ module IDRAC
395
395
  else
396
396
  debug "Failed to reset iDRAC. Status code: #{response.status}", 1, :red
397
397
  end
398
- rescue => e
398
+ rescue
399
399
  debug "Failed to reset iDRAC. Status code: #{response.status}", 1, :red
400
400
  debug "Error response: #{response.body}", 2, :red
401
401
  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.8.0"
4
+ VERSION = "0.8.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.8.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel
@@ -155,20 +155,14 @@ dependencies:
155
155
  requirements:
156
156
  - - ">="
157
157
  - !ruby/object:Gem::Version
158
- version: '6.0'
159
- - - "<"
160
- - !ruby/object:Gem::Version
161
- version: '8.1'
158
+ version: '7.0'
162
159
  type: :runtime
163
160
  prerelease: false
164
161
  version_requirements: !ruby/object:Gem::Requirement
165
162
  requirements:
166
163
  - - ">="
167
164
  - !ruby/object:Gem::Version
168
- version: '6.0'
169
- - - "<"
170
- - !ruby/object:Gem::Version
171
- version: '8.1'
165
+ version: '7.0'
172
166
  - !ruby/object:Gem::Dependency
173
167
  name: bundler
174
168
  requirement: !ruby/object:Gem::Requirement
@@ -260,7 +254,6 @@ files:
260
254
  - README.md
261
255
  - bin/console
262
256
  - bin/idrac
263
- - bin/idrac-tsr
264
257
  - bin/setup
265
258
  - idrac.gemspec
266
259
  - lib/idrac.rb
@@ -281,11 +274,12 @@ files:
281
274
  - lib/idrac/version.rb
282
275
  - lib/idrac/virtual_media.rb
283
276
  - lib/idrac/web.rb
284
- homepage: http://github.com
277
+ homepage: https://github.com/buildio/idrac
285
278
  licenses:
286
279
  - MIT
287
280
  metadata:
288
- homepage_uri: http://github.com
281
+ homepage_uri: https://github.com/buildio/idrac
282
+ source_code_uri: https://github.com/buildio/idrac
289
283
  rdoc_options: []
290
284
  require_paths:
291
285
  - lib
@@ -293,7 +287,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
293
287
  requirements:
294
288
  - - ">="
295
289
  - !ruby/object:Gem::Version
296
- version: 3.2.0
290
+ version: 2.7.0
297
291
  required_rubygems_version: !ruby/object:Gem::Requirement
298
292
  requirements:
299
293
  - - ">="
data/bin/idrac-tsr DELETED
@@ -1,90 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require_relative '../lib/idrac'
4
- require 'optparse'
5
-
6
- options = {
7
- host: ENV['IDRAC_HOST'],
8
- username: ENV['IDRAC_USER'] || 'root',
9
- password: ENV['IDRAC_PASSWORD'] || 'calvin',
10
- output: nil,
11
- data_types: [0, 1, 2], # Default: Hardware, OS, Debug
12
- timeout: 600,
13
- verbose: false
14
- }
15
-
16
- OptionParser.new do |opts|
17
- opts.banner = "Usage: idrac-tsr [options]"
18
-
19
- opts.on("-h", "--host HOST", "iDRAC host address") do |h|
20
- options[:host] = h
21
- end
22
-
23
- opts.on("-u", "--username USER", "Username (default: root)") do |u|
24
- options[:username] = u
25
- end
26
-
27
- opts.on("-p", "--password PASS", "Password (default: calvin)") do |p|
28
- options[:password] = p
29
- end
30
-
31
- opts.on("-o", "--output FILE", "Output filename (default: auto-generated)") do |o|
32
- options[:output] = o
33
- end
34
-
35
- opts.on("-d", "--data TYPES", "Data types to collect (comma-separated: 0=HW,1=OS,2=Debug,3=TTY,4=All)") do |d|
36
- options[:data_types] = d.split(',').map(&:to_i)
37
- end
38
-
39
- opts.on("-t", "--timeout SECONDS", Integer, "Timeout in seconds (default: 600)") do |t|
40
- options[:timeout] = t
41
- end
42
-
43
- opts.on("-v", "--verbose", "Verbose output") do
44
- options[:verbose] = true
45
- end
46
-
47
- opts.on("--help", "Show this message") do
48
- puts opts
49
- exit
50
- end
51
- end.parse!
52
-
53
- if options[:host].nil?
54
- puts "Error: Host is required. Use -h HOST or set IDRAC_HOST environment variable"
55
- exit 1
56
- end
57
-
58
- begin
59
- client = IDRAC::Client.new(
60
- host: options[:host],
61
- username: options[:username],
62
- password: options[:password],
63
- verify_ssl: false
64
- )
65
-
66
- client.verbosity = options[:verbose] ? 1 : 0
67
-
68
- puts "Connecting to #{options[:host]}..."
69
- client.login
70
-
71
- puts "Generating TSR logs (this may take several minutes)..."
72
- result = client.generate_and_download_tsr(
73
- output_file: options[:output],
74
- data_selector_values: options[:data_types],
75
- wait_timeout: options[:timeout]
76
- )
77
-
78
- if result
79
- puts "✓ TSR logs saved to: #{result}"
80
- puts " File size: #{File.size(result) / 1024 / 1024} MB" if File.exist?(result)
81
- else
82
- puts "✗ Failed to download TSR logs"
83
- exit 1
84
- end
85
-
86
- client.logout
87
- rescue => e
88
- puts "Error: #{e.message}"
89
- exit 1
90
- end