From ed59ce03698d795b7a6d88687b7038e9e80641e9 Mon Sep 17 00:00:00 2001 From: Sonu Saha <98935583+ahasunos@users.noreply.github.com> Date: Tue, 6 Aug 2024 16:52:02 +0530 Subject: [PATCH] enhance: improve fetch and persist to catch entitlement exception (#7121) Signed-off-by: Sonu Saha --- lib/inspec/base_cli.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/inspec/base_cli.rb b/lib/inspec/base_cli.rb index 074555d7a..38112c829 100644 --- a/lib/inspec/base_cli.rb +++ b/lib/inspec/base_cli.rb @@ -54,6 +54,9 @@ module Inspec rescue ChefLicensing::LicenseKeyFetcher::LicenseKeyNotFetchedError Inspec::Log.error "#{Inspec::Dist::PRODUCT_NAME} cannot execute without valid licenses." 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 Inspec::Log.error e.message Inspec::UI.new.exit(:usage_error)