Class: ChefLicensing::LicenseFile::V4

Inherits:
Base
  • Object
show all
Defined in:
lib/chef-licensing/license_key_fetcher/license_file/v4.rb

Constant Summary collapse

LICENSE_FILE_FORMAT_VERSION =
"4.0.0".freeze
EXPECTED_STRUCTURE =
EXPECTED_STRUCTURE.merge({
  file_format_version: V4::LICENSE_FILE_FORMAT_VERSION,
  license_server_url: String,
}).freeze

Class Method Summary collapse

Methods inherited from Base

load_primary_structure, load_structure, verify_structure

Class Method Details

.migrate_structure(contents, version) ⇒ Hash

Returns The contents of the license file after migration.

Parameters:

  • contents: (Hash)

    The contents of the license file

  • version: (Integer)

    The version of the license file

Returns:

  • (Hash)

    The contents of the license file after migration



17
18
19
20
21
22
23
24
# File 'lib/chef-licensing/license_key_fetcher/license_file/v4.rb', line 17

def self.migrate_structure(contents, version)
  # Backwards compatibility for version 3 license files
  if version == 3
    contents[:license_server_url] = ChefLicensing::Config.license_server_url || ""
    contents[:file_format_version] = V4::LICENSE_FILE_FORMAT_VERSION
  end
  contents
end