idrac 0.5.1 → 0.5.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: 75d31422362fd2d548fff6e03265162bdf4cfb34237085a7e9e14170bcd8d5eb
4
- data.tar.gz: 219ca3faaaf4e3b8d85ceb0db0baebe5ffa81c2e5afc61ba13851c76fd1f6b41
3
+ metadata.gz: e1bffe050d6256766e75d7a51d80133d14c3b86abcfc53b1de4e172be80f4747
4
+ data.tar.gz: c74c883203a6b14e2f18041c7df0e4dacae125cbf6f6cc6a3da2a0dd1bc56ef6
5
5
  SHA512:
6
- metadata.gz: b37b6e6094ee872b2989dcd4d66a8a965502ed7193a66813d5ed3ff60592cfae47c26f9caf9b2f0c34580d366845b49414f55bd909519618d8439cdb71fe8473
7
- data.tar.gz: 30ffb9cbd571489a12f71c553777089541c3550287aca5a267bc4b964da41ff268219ca9e4306097c0aced7ae29a1bd7d17f6ccccfefd45f77778a29891801e1
6
+ metadata.gz: db7644ef1fd92b3af97d0c202d5e3b6d80963bb5ecbe24b4a339249184c29667e7e0dea3f7e99074afaa52af127ef249c9768cf322156a12769a230d7cee7b76
7
+ data.tar.gz: 63e817a2e85d68f3c848658adefe7567ebd629546b15362d7ac32c9cb19aea4edd54f5091bf893f38a8f52c84eaa9c6ffda07b71fb4abc8872fde4bf74959961
data/bin/idrac CHANGED
@@ -463,11 +463,11 @@ module IDRAC
463
463
  license = client.license_info
464
464
  if license
465
465
  puts "\nLicense Information:".green.bold
466
- puts "Description: #{license['Description']}".cyan
467
- puts "License Type: #{license['LicenseType']}".cyan
466
+ puts "Description: #{license.Description}".cyan
467
+ puts "License Type: #{license.LicenseType}".cyan
468
468
  puts "License Version: #{client.license_version || 'Unknown'}".cyan
469
- puts "Removable: #{license['Removable']}".cyan
470
- puts "Status: #{license.dig('Status', 'Health') || 'Unknown'}".cyan
469
+ puts "Removable: #{license.Removable}".cyan
470
+ puts "Status: #{license&.Status&.Health || 'Unknown'}".cyan
471
471
  else
472
472
  puts "No license information available".yellow
473
473
  end
data/lib/idrac/license.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module IDRAC
2
2
  module License
3
3
  # Gets the license information from the iDRAC
4
- # @return [Hash] License details
4
+ # @return [RecursiveOpenStruct] License details
5
5
  def license_info
6
6
  response = authenticated_request(:get, "/redfish/v1/LicenseService/Licenses")
7
7
  if response.status != 200
@@ -32,7 +32,7 @@ module IDRAC
32
32
  license_details = JSON.parse(license_response.body)
33
33
  debug "License details: #{license_details}", 2
34
34
 
35
- return license_details
35
+ return RecursiveOpenStruct.new(license_details, recurse_over_arrays: true)
36
36
  end
37
37
 
38
38
  # Extracts the iDRAC version from the license description
@@ -43,15 +43,15 @@ module IDRAC
43
43
 
44
44
  # Check the Description field, which often contains the version
45
45
  # Example: "iDRAC9 Enterprise License"
46
- if license["Description"] && license["Description"].match(/iDRAC(\d+)/i)
47
- version = license["Description"].match(/iDRAC(\d+)/i)[1].to_i
46
+ if license.Description && license.Description.match(/iDRAC(\d+)/i)
47
+ version = license.Description.match(/iDRAC(\d+)/i)[1].to_i
48
48
  debug "Found license version from Description: #{version}", 1
49
49
  return version
50
50
  end
51
51
 
52
52
  # Try alternative fields if Description didn't work
53
- if license["Name"] && license["Name"].match(/iDRAC(\d+)/i)
54
- version = license["Name"].match(/iDRAC(\d+)/i)[1].to_i
53
+ if license.Name && license.Name.match(/iDRAC(\d+)/i)
54
+ version = license.Name.match(/iDRAC(\d+)/i)[1].to_i
55
55
  debug "Found license version from Name: #{version}", 1
56
56
  return version
57
57
  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.5.1"
4
+ VERSION = "0.5.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.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Siegel