idrac 0.1.30 → 0.1.38

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: 6992752c6eee7bfb3c858d8bb465c68c68bff2008732ecfc88553ba7ac0524b5
4
- data.tar.gz: ab1e816e1c1d903c3095c5131652f917a61b3c4006e0941fd05d24555230f9f5
3
+ metadata.gz: 462eec3a8d4efc8ef0c8b79247cb3b5624f96c97b1cb2b98e10311939fcea521
4
+ data.tar.gz: 91793e111a24c4d71ef4ab9c38ea6291630b4314e754f108068a6cded9c23b70
5
5
  SHA512:
6
- metadata.gz: b65362922f5a5728e6840a005ee7a79f2c08a835bba4ae7394eb304d2992426d9a9a52457173eb579e8e792413767c9249c64f5eacaee9dd47105971b10b3187
7
- data.tar.gz: 8f97a86b72b0fb3544cb85c61f94b8228b037f63adeb345d9da856f7159d7e698c176fd303e212182dd779496b77c07b0b2efe83cc8d8fe8cee281060132d0e0
6
+ metadata.gz: 0e6ecd835d5f68d3e4230944843131d70cc5e239bfc546127af7fed5d9fe83a82c4c5421f68fd88ea76f6f94fc9df8193405c936f20ee1a4905cc66e3d457bd7
7
+ data.tar.gz: e301acc6c69c352fb3ae4bc2503a7501ab01fe4dd3af9597a2b276aa468c98cb9a9e03c649e55271b26edc8d738b7fcf758e46ab5adef4100cbd6553583f1371
data/README.md CHANGED
@@ -54,6 +54,11 @@ idrac firmware:update /path/to/firmware.exe --host=192.168.1.100 --username=root
54
54
 
55
55
  # Interactive firmware update
56
56
  idrac firmware:interactive --host=192.168.1.100 --username=root --password=calvin
57
+
58
+ # Display a summary of system information
59
+ idrac summary --host=192.168.1.100 --username=root --password=calvin
60
+ # With verbose output for debugging
61
+ idrac summary --host=192.168.1.100 --username=root --password=calvin --verbose
57
62
  ```
58
63
 
59
64
  All commands automatically handle session expiration by re-authenticating when necessary, ensuring that long-running operations like firmware updates complete successfully even if the iDRAC session times out.
@@ -134,14 +139,51 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
134
139
 
135
140
  ## Changelog
136
141
 
142
+ ### Version 0.1.38
143
+ - **Enhanced License Display**: Updated the summary command to show both license type and description
144
+ - Improved readability by displaying license information in the format "Type (Description)"
145
+ - Better user experience with more detailed license information
146
+
147
+ ### Version 0.1.37
148
+ - **Improved License Detection**: Enhanced license detection using both DMTF standard and Dell OEM methods
149
+ - Added fallback mechanisms to ensure proper license type detection
150
+ - Improved error handling for license information retrieval
151
+
152
+ ### Version 0.1.36
153
+ - **Fixed License Type Display**: Updated the summary command to correctly display Enterprise license
154
+ - **Added Verbose Mode**: New `--verbose` option for the summary command to show detailed API responses
155
+ - Improved debugging capabilities with raw JSON output of system, iDRAC, network, and license information
156
+
157
+ ### Version 0.1.35
158
+ - **Added System Summary Command**: New `summary` command to display key system information
159
+ - Shows power state, model, host name, OS details, service tag, firmware versions, and more
160
+ - Formatted output with color-coding for improved readability
161
+
162
+ ### Version 0.1.34
163
+ - **Fixed Gem Build Process**: Corrected version mismatch in the Rakefile
164
+ - **Improved CLI Structure**: Removed hardcoded command list in favor of explicit host requirements in each command
165
+ - Enhanced code organization and maintainability
166
+
167
+ ### Version 0.1.33
168
+ - **Fixed Command-Line Interface**: Improved handling of commands that don't require a host
169
+ - Made the `firmware:catalog` command work without requiring host, username, and password
170
+ - Enhanced command-line interface reliability
171
+
172
+ ### Version 0.1.32
173
+ - **Fixed Gem Loading Issues**: Ensured proper loading of the colorize gem in the main module
174
+ - Resolved issues with running commands when installed as a gem
175
+ - Improved reliability of command-line interface
176
+
177
+ ### Version 0.1.31
178
+ - **Enhanced Job Monitoring**: Improved firmware update job tracking and monitoring
179
+ - Added more robust error handling during firmware updates
180
+ - Enhanced progress reporting with color-coded status messages
181
+ - Improved recovery mechanisms for common firmware update issues
182
+
137
183
  ### Version 0.1.30
138
- - **Enhanced Terminal Output with Colors**: Added colorized output for better readability and user experience
139
- - Integrated the `colorize` gem to provide color-coded messages throughout the application
140
- - Success messages are displayed in green, warnings in yellow, errors in red, and informational messages in cyan
141
- - Improved visual distinction between different types of messages (success, error, warning, info)
142
- - Enhanced readability of firmware update status, system information, and error messages
143
- - Updated all output messages across the codebase for consistent color formatting
144
- - Added color to the test script output for better visualization of the firmware update process
184
+ - **Added Color Output**: Enhanced terminal output with color-coded messages
185
+ - Improved readability of status, warning, and error messages
186
+ - Added the colorize gem as a dependency
145
187
 
146
188
  ### Version 0.1.29
147
189
  - **Enhanced Firmware Update Error Handling**: Improved detection and handling of common firmware update issues
@@ -204,89 +246,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
204
246
 
205
247
  ### Version 0.1.21
206
248
  - **Improved Authentication Flow**: Completely restructured the login process
207
- - Renamed `legacy_login` to `webui_login` and limited its use to screenshot functionality only
208
- - Implemented proper Redfish authentication flow: start with direct login to get a session
209
- - Enhanced session management: when max sessions are encountered, delete sessions using direct login
210
- - Simplified code by removing redundant authentication methods and focusing on Redfish standards
211
- - Improved error handling and logging for better troubleshooting
212
-
213
- ### Version 0.1.20
214
- - **Simplified CLI Interface**: Removed the direct-mode CLI option
215
- - Maintained internal direct mode functionality as an automatic fallback mechanism
216
- - The client will still automatically switch to direct mode when session management fails
217
- - This change simplifies the user interface while preserving the robust session handling
218
-
219
- ### Version 0.1.19
220
- - **Basic Auth Session Clearing**: Implemented direct session management using Basic Authentication
221
- - Added ability to list and delete all active sessions without requiring a session
222
- - Improved session clearing by directly accessing the Redfish Sessions API with Basic Auth
223
- - Enhanced force_clear_sessions to first try the direct Basic Auth approach before falling back to login/logout cycles
224
- - Added detailed logging of session clearing operations
225
-
226
- ### Version 0.1.18
227
- - **Direct Mode Implementation**: Added a fallback mechanism for environments with persistent session issues
228
- - Implemented automatic switching to direct mode (Basic Auth) when session creation repeatedly fails
229
- - Added detection of maximum sessions condition to avoid unnecessary session creation attempts
230
- - Improved handling of authentication failures with graceful degradation to direct mode
231
- - Added Basic Auth support for all request types when in direct mode
232
- - Enhanced logging for better visibility into authentication mode changes
233
-
234
- ### Version 0.1.17
235
- - **Enhanced Session Clearing**: Added aggressive session clearing functionality
236
- - Implemented a force_clear_sessions method that attempts multiple login/logout cycles with both authentication methods
237
- - Added automatic session clearing when maximum sessions error is encountered
238
- - Improved retry logic after session clearing
239
- - Added detailed logging during session clearing process for better troubleshooting
240
-
241
- ### Version 0.1.16
242
- - **Implemented Redfish API Session Management**: Completely redesigned session handling to use the proper Redfish API
243
- - Added support for X-Auth-Token authentication (the standard Redfish approach)
244
- - Maintained backward compatibility with legacy session management for screenshot functionality
245
- - Improved session creation and deletion with proper error handling
246
- - Added fallback mechanism to legacy authentication if Redfish session creation fails
247
- - Enhanced logging for better troubleshooting of session-related issues
248
-
249
- ### Version 0.1.15
250
- - **Aggressive Session Management**: Implemented a more robust approach to handle persistent session issues
251
- - Added retry counters with limits to prevent infinite loops
252
- - Increased delays between logout and login operations (5 seconds)
253
- - Added multiple logout attempts to ensure sessions are properly cleared
254
- - Added pre-emptive logout before login to help clear existing sessions
255
- - Improved error messages with attempt counters for better debugging
256
-
257
- ### Version 0.1.14
258
- - **Enhanced Session Management**: Improved handling of "maximum number of user sessions" errors
259
- - Added detection and handling of session limits during initial login
260
- - Added retry mechanism with proper session cleanup
261
- - Added delays between logout and login operations to allow server to process session changes
262
- - Made logout operation more robust by handling potential errors
263
-
264
- ### Version 0.1.13
265
- - **Fixed Maximum Sessions Error**: Added handling for "maximum number of user sessions" errors
266
- - The client now properly logs out before attempting to create a new session
267
- - Improved session management to prevent session buildup on the iDRAC server
268
-
269
- ### Version 0.1.12
270
- - **Improved Session Handling**: Added automatic re-authentication when sessions expire (401 errors)
271
- - The client now automatically re-logs in and retries the request when it encounters a 401 Unauthorized error
272
- - This prevents interruptions during long-running operations when the iDRAC session times out
273
-
274
- ### Version 0.1.11
275
- - Added support for Ruby 3.2.x (previously required Ruby 3.3.0+)
276
- - Fixed SSL verification warnings by making SSL verification optional
277
- - Improved error handling and reporting
278
-
279
- ### Version 0.1.10
280
- - Added base64 gem as a dependency to address Ruby 3.4.0 compatibility warnings
281
- - Updated dependency versions with bounded requirements
282
- - Added proper license specification in gemspec
283
-
284
- ### Version 0.1.9
285
- - Added screenshot functionality with custom output filename support
286
- - Improved firmware update process with better progress reporting
287
- - Enhanced error handling for network connectivity issues
288
- - Added default credentials (root/calvin) to simplify command usage
289
-
290
- ## Contributing
291
-
292
- Bug reports and pull requests are welcome on GitHub at https://github.com/usiegj00/idrac.
249
+ - Renamed `
data/bin/idrac CHANGED
@@ -11,23 +11,24 @@ end
11
11
  require "thor"
12
12
  require "idrac"
13
13
  require "colorize"
14
+ require "json"
14
15
 
15
16
  module IDRAC
16
17
  class CLI < Thor
17
18
  # Make host not required for all commands
18
19
  class_option :host, type: :string, required: false, desc: "iDRAC host address"
19
- class_option :username, type: :string, required: false, default: "root", desc: "iDRAC username (default: root)"
20
- class_option :password, type: :string, required: false, default: "calvin", desc: "iDRAC password (default: calvin)"
20
+ class_option :username, type: :string, required: false, default: "root", desc: "iDRAC username"
21
+ class_option :password, type: :string, required: false, default: "calvin", desc: "iDRAC password"
21
22
  class_option :port, type: :numeric, default: 443, desc: "iDRAC port"
22
23
  class_option :no_ssl, type: :boolean, default: false, desc: "Disable SSL"
23
24
  class_option :verify_ssl, type: :boolean, default: false, desc: "Enable SSL verification (not recommended for iDRAC's self-signed certificates)"
24
- class_option :auto_delete_sessions, type: :boolean, default: true, desc: "Automatically delete sessions when maximum sessions are reached (default: true)"
25
+ class_option :auto_delete_sessions, type: :boolean, default: true, desc: "Automatically delete sessions when maximum sessions are reached"
25
26
 
26
27
  desc "firmware:update PATH", "Update firmware using the specified file"
27
28
  method_option :wait, type: :boolean, default: true, desc: "Wait for the update to complete"
28
29
  method_option :timeout, type: :numeric, default: 3600, desc: "Timeout in seconds when waiting"
29
30
  def firmware_update(path)
30
- # Ensure host is provided for commands that need it
31
+ # This command requires a host
31
32
  ensure_host_provided
32
33
 
33
34
  check_ssl_verification
@@ -48,11 +49,10 @@ module IDRAC
48
49
  desc "firmware:catalog [DIRECTORY]", "Download Dell firmware catalog"
49
50
  def firmware_catalog(directory = nil)
50
51
  # This command doesn't require a host
51
- # Create a FirmwareCatalog instance directly
52
52
  catalog = IDRAC::FirmwareCatalog.new
53
53
 
54
54
  begin
55
- puts "Downloading Dell catalog...".yellow
55
+ puts "Downloading Dell catalog...".light_cyan
56
56
  catalog_path = catalog.download(directory)
57
57
  puts "Catalog downloaded to: #{catalog_path}".green
58
58
  rescue IDRAC::Error => e
@@ -64,7 +64,7 @@ module IDRAC
64
64
  desc "firmware:status", "Show current firmware status and available updates"
65
65
  method_option :catalog, type: :string, desc: "Path to existing catalog file"
66
66
  def firmware_status
67
- # Ensure host is provided for commands that need it
67
+ # This command requires a host
68
68
  ensure_host_provided
69
69
 
70
70
  check_ssl_verification
@@ -113,7 +113,7 @@ module IDRAC
113
113
  desc "firmware:interactive", "Interactive firmware update"
114
114
  method_option :catalog, type: :string, desc: "Path to existing catalog file"
115
115
  def firmware_interactive
116
- # Ensure host is provided for commands that need it
116
+ # This command requires a host
117
117
  ensure_host_provided
118
118
 
119
119
  check_ssl_verification
@@ -178,7 +178,7 @@ module IDRAC
178
178
  desc "screenshot", "Take a screenshot of the current iDRAC console"
179
179
  method_option :output, type: :string, desc: "Output filename (default: idrac_screenshot_timestamp.png)"
180
180
  def screenshot
181
- # Ensure host is provided for commands that need it
181
+ # This command requires a host
182
182
  ensure_host_provided
183
183
 
184
184
  check_ssl_verification
@@ -205,6 +205,123 @@ module IDRAC
205
205
  end
206
206
  end
207
207
 
208
+ desc "summary", "Display a summary of system information"
209
+ method_option :verbose, type: :boolean, default: false, desc: "Show verbose output including raw API responses"
210
+ def summary
211
+ # This command requires a host
212
+ ensure_host_provided
213
+
214
+ check_ssl_verification
215
+ client = create_client
216
+
217
+ begin
218
+ # Get system information using authenticated_request
219
+ puts "Retrieving system information...".light_yellow if options[:verbose]
220
+ system_response = client.authenticated_request(:get, "/redfish/v1/Systems/System.Embedded.1")
221
+ system_info = JSON.parse(system_response.body)
222
+ puts JSON.pretty_generate(system_info).light_yellow if options[:verbose]
223
+
224
+ # Get iDRAC information using authenticated_request
225
+ puts "Retrieving iDRAC information...".light_yellow if options[:verbose]
226
+ idrac_response = client.authenticated_request(:get, "/redfish/v1/Managers/iDRAC.Embedded.1")
227
+ idrac_info = JSON.parse(idrac_response.body)
228
+ puts JSON.pretty_generate(idrac_info).light_yellow if options[:verbose]
229
+
230
+ # Get network information using authenticated_request
231
+ puts "Retrieving network information...".light_yellow if options[:verbose]
232
+ network_response = client.authenticated_request(:get, "/redfish/v1/Managers/iDRAC.Embedded.1/EthernetInterfaces/NIC.1")
233
+ network_info = JSON.parse(network_response.body)
234
+ puts JSON.pretty_generate(network_info).light_yellow if options[:verbose]
235
+
236
+ # Initialize license_type to Unknown
237
+ license_type = "Unknown"
238
+ license_description = nil
239
+
240
+ # Try to get license information using DMTF standard method
241
+ begin
242
+ puts "Retrieving license information (DMTF method)...".light_yellow if options[:verbose]
243
+ license_response = client.authenticated_request(:get, "/redfish/v1/LicenseService/Licenses")
244
+ license_info = JSON.parse(license_response.body)
245
+ puts JSON.pretty_generate(license_info).light_yellow if options[:verbose]
246
+
247
+ # Extract license type if licenses are found
248
+ if license_info["Members"] && !license_info["Members"].empty?
249
+ license_entry_response = client.authenticated_request(:get, license_info["Members"][0]["@odata.id"])
250
+ license_entry = JSON.parse(license_entry_response.body)
251
+ puts JSON.pretty_generate(license_entry).light_yellow if options[:verbose]
252
+
253
+ # Get license type from EntitlementId or LicenseType
254
+ if license_entry["EntitlementId"] && license_entry["EntitlementId"].include?("Enterprise")
255
+ license_type = "Enterprise"
256
+ elsif license_entry["LicenseType"]
257
+ license_type = license_entry["LicenseType"]
258
+ end
259
+
260
+ # Get license description if available
261
+ license_description = license_entry["Description"] if license_entry["Description"]
262
+ end
263
+ rescue => e
264
+ puts "Error retrieving license information using DMTF method: #{e.message}".light_red if options[:verbose]
265
+
266
+ # If DMTF method fails, try Dell OEM method
267
+ begin
268
+ puts "Retrieving license information (Dell OEM method)...".light_yellow if options[:verbose]
269
+ dell_license_response = client.authenticated_request(:get, "/redfish/v1/Managers/iDRAC.Embedded.1/Oem/Dell/DellLicenses")
270
+ dell_license_info = JSON.parse(dell_license_response.body)
271
+ puts JSON.pretty_generate(dell_license_info).light_yellow if options[:verbose]
272
+
273
+ # Extract license type if licenses are found
274
+ if dell_license_info["Members"] && !dell_license_info["Members"].empty?
275
+ dell_license_entry_response = client.authenticated_request(:get, dell_license_info["Members"][0]["@odata.id"])
276
+ dell_license_entry = JSON.parse(dell_license_entry_response.body)
277
+ puts JSON.pretty_generate(dell_license_entry).light_yellow if options[:verbose]
278
+
279
+ # Get license type from LicenseType or Description
280
+ if dell_license_entry["LicenseType"]
281
+ license_type = dell_license_entry["LicenseType"]
282
+ elsif dell_license_entry["Description"] && dell_license_entry["Description"].include?("Enterprise")
283
+ license_type = "Enterprise"
284
+ end
285
+
286
+ # Get license description if available
287
+ license_description = dell_license_entry["Description"] if dell_license_entry["Description"]
288
+ end
289
+ rescue => e2
290
+ puts "Error retrieving Dell license information: #{e2.message}".light_red if options[:verbose]
291
+ end
292
+ end
293
+
294
+ # Format the license display string
295
+ license_display = license_type
296
+ if license_description
297
+ license_display = "#{license_type} (#{license_description})"
298
+ end
299
+
300
+ # Format and display the information
301
+ puts "System Summary:".green.bold
302
+ puts "=" * 50
303
+
304
+ puts "Power State:".ljust(25) + (system_info["PowerState"] || "Unknown").light_cyan
305
+ puts "Model:".ljust(25) + (system_info["Model"] || "Unknown").light_cyan
306
+ puts "Host Name:".ljust(25) + (system_info["HostName"] || "Unknown").light_cyan
307
+ puts "Operating System:".ljust(25) + (system_info.dig("Oem", "Dell", "OperatingSystem") || "Unknown").light_cyan
308
+ puts "Operating System Version:".ljust(25) + (system_info.dig("Oem", "Dell", "OperatingSystemVersion") || "Unknown").light_cyan
309
+ puts "Service Tag:".ljust(25) + (system_info["SKU"] || "Unknown").light_cyan
310
+ puts "BIOS Version:".ljust(25) + (system_info.dig("BiosVersion") || "Unknown").light_cyan
311
+ puts "iDRAC Firmware Version:".ljust(25) + (idrac_info.dig("FirmwareVersion") || "Unknown").light_cyan
312
+ puts "IP Address:".ljust(25) + (network_info.dig("IPv4Addresses", 0, "Address") || "Unknown").light_cyan
313
+ puts "iDRAC MAC Address:".ljust(25) + (network_info.dig("MACAddress") || "Unknown").light_cyan
314
+ puts "License:".ljust(25) + license_display.light_cyan
315
+
316
+ puts "=" * 50
317
+ rescue IDRAC::Error => e
318
+ puts "Error: #{e.message}".red.bold
319
+ exit 1
320
+ ensure
321
+ client.logout
322
+ end
323
+ end
324
+
208
325
  map "firmware:update" => :firmware_update
209
326
  map "firmware:catalog" => :firmware_catalog
210
327
  map "firmware:status" => :firmware_status
@@ -213,7 +330,7 @@ module IDRAC
213
330
  private
214
331
 
215
332
  def ensure_host_provided
216
- unless options[:host]
333
+ if !options[:host]
217
334
  puts "Error: No value provided for required option '--host'".red.bold
218
335
  exit 1
219
336
  end
@@ -235,8 +352,7 @@ module IDRAC
235
352
  password: options[:password],
236
353
  port: options[:port],
237
354
  use_ssl: !options[:no_ssl],
238
- verify_ssl: options[:verify_ssl],
239
- auto_delete_sessions: options[:auto_delete_sessions]
355
+ verify_ssl: options[:verify_ssl]
240
356
  )
241
357
  end
242
358
  end
data/idrac.gemspec CHANGED
@@ -21,13 +21,14 @@ Gem::Specification.new do |spec|
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.
24
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
- spec.files = Dir.chdir(__dir__) do
26
- `git ls-files -z`.split("\x0").reject do |f|
27
- (File.expand_path(f) == __FILE__) ||
28
- f.start_with?(*%w[test/ spec/ features/ .git .circleci appveyor Gemfile])
29
- end
30
- end
24
+ # Instead of using git ls-files, use a more explicit approach
25
+ spec.files = Dir[
26
+ "lib/**/*",
27
+ "bin/*",
28
+ "README.md",
29
+ "LICENSE.txt",
30
+ "*.gemspec"
31
+ ]
31
32
  spec.bindir = "bin"
32
33
  spec.executables = ["idrac"]
33
34
  spec.require_paths = ["lib"]
@@ -39,7 +40,7 @@ Gem::Specification.new do |spec|
39
40
  spec.add_dependency "faraday-multipart", ">= 1.0.0", "< 1.1.0"
40
41
  spec.add_dependency "thor", ">= 1.2.0", "< 1.4.0"
41
42
  spec.add_dependency "base64", "~> 0.1", ">= 0.1.0"
42
- spec.add_dependency "colorize", "~> 0.8"
43
+ spec.add_dependency "colorize", "~> 1.1"
43
44
 
44
45
  # Development dependencies
45
46
  spec.add_development_dependency "bundler", "~> 2.4", ">= 2.4.0"