Method: ChefLicensing.fetch_and_persist

Defined in:
lib/chef-licensing.rb

.fetch_and_persistObject

Note:

fetch_and_persist is invoked by chef-products to fetch and persist the license keys



66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/chef-licensing.rb', line 66

def fetch_and_persist
  # Return early if make_licensing_optional is enabled
  return true if ChefLicensing::Config.make_licensing_optional

  ChefLicensing::LicenseKeyFetcher.fetch_and_persist
rescue ChefLicensing::ClientError => e
  # Checking specific text phrase for entitlement error
  if e.message.match?(/not entitled/)
    raise(ChefLicensing::SoftwareNotEntitled, "Software is not entitled.")
  else
    raise
  end
end