Module: IDRAC::License

Included in:
Client
Defined in:
lib/idrac/license.rb

Instance Method Summary collapse

Instance Method Details

#clear_license_version_cacheObject

Clear the cached license version (useful if iDRAC state changes)



49
50
51
# File 'lib/idrac/license.rb', line 49

def clear_license_version_cache
  @license_version = nil
end

#license_infoHash

Gets the license information from the iDRAC

Returns:

  • (Hash)

    License details



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/idrac/license.rb', line 5

def license_info
  # Try the standard license endpoint first (works in iDRAC 9+)
  response = authenticated_request(:get, "/redfish/v1/LicenseService/Licenses")
  
  if response.status == 200
    license_data = JSON.parse(response.body)
    debug "License collection: #{license_data}", 2

    # Check if there are any license entries
    if !license_data["Members"] || license_data["Members"].empty?
      debug "No licenses found", 1, :yellow
      return try_dell_oem_license_path()
    end

    # Get the first license in the list
    license_uri = license_data["Members"][0]["@odata.id"]
    debug "Using license URI: #{license_uri}", 2

    # Get detailed license information
    license_response = authenticated_request(:get, license_uri)
    if license_response.status != 200
      debug "Failed to retrieve license details: #{license_response.status}", 1, :red
      return try_dell_oem_license_path()
    end

    license_details = JSON.parse(license_response.body)
    debug "License details: #{license_details}", 2

    return license_details
  else
    # The endpoint is not available (probably iDRAC 8)
    debug "Standard license endpoint failed: #{response.status}, trying Dell OEM path", 1, :yellow
    return try_dell_oem_license_path()
  end
end

#license_versionInteger?

Extracts the iDRAC version from the license description or server header

Returns:

  • (Integer, nil)

    The license version (e.g. 9) or nil if not found



43
44
45
46
# File 'lib/idrac/license.rb', line 43

def license_version
  # Use memoization to cache the result and avoid multiple API calls
  @license_version ||= compute_license_version
end