enhance: improve fetch and persist to catch entitlement exception (#7121)

Signed-off-by: Sonu Saha <sonu.saha@progress.com>
This commit is contained in:
Sonu Saha 2024-08-06 16:52:02 +05:30 committed by GitHub
parent 357e7e8459
commit ed59ce0369
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -54,6 +54,9 @@ module Inspec
rescue ChefLicensing::LicenseKeyFetcher::LicenseKeyNotFetchedError rescue ChefLicensing::LicenseKeyFetcher::LicenseKeyNotFetchedError
Inspec::Log.error "#{Inspec::Dist::PRODUCT_NAME} cannot execute without valid licenses." Inspec::Log.error "#{Inspec::Dist::PRODUCT_NAME} cannot execute without valid licenses."
Inspec::UI.new.exit(:license_not_set) Inspec::UI.new.exit(:license_not_set)
rescue ChefLicensing::SoftwareNotEntitled
Inspec::Log.error "License is not entitled to use InSpec."
Inspec::UI.new.exit(:license_not_entitled)
rescue ChefLicensing::Error => e rescue ChefLicensing::Error => e
Inspec::Log.error e.message Inspec::Log.error e.message
Inspec::UI.new.exit(:usage_error) Inspec::UI.new.exit(:usage_error)