Sha256: 6a08d8dc9c50bdf320cf27394fb1dd5606db6e87f1f661b4a347b9a1573658ac
Contents?: true
Size: 1.16 KB
Versions: 1
Compression:
Stored size: 1.16 KB
Contents
require_relative "licensing_config" class Chef class Utils class LicensingHandler LEGACY_OMNITRUCK_URL = "https://omnitruck.chef.io".freeze OMNITRUCK_URLS = { "free" => "https://chefdownload-trial.chef.io", "trial" => "https://chefdownload-trial.chef.io", "commercial" => "https://chefdownload-commerical.chef.io", }.freeze attr_reader :license_key, :license_type def initialize(key, type) @license_key = key @license_type = type end def omnitruck_url url = OMNITRUCK_URLS[license_type] || LEGACY_OMNITRUCK_URL "#{url}/%s#{license_key ? "?license_id=#{license_key}" : ""}" end def install_sh_url format(omnitruck_url, "install.sh") end class << self def validate! license_keys = ChefLicensing::LicenseKeyFetcher.fetch return new(nil, nil) if license_keys.blank? licenses_metadata = ChefLicensing::Api::Describe.list({ license_keys: license_keys, }) new(licenses_metadata.last.id, licenses_metadata.last.license_type) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
knife-18.6.2 | lib/chef/utils/licensing_handler.rb |