CHEF-3895: Prevent Stacktrace in STDOUT by handling Invalid License exception during license add (#77)

* FIX: Handle invalid license exception as handled in base_cli:57

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* Use 174 error code when exiting with license subsystem error from license add

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

---------

Signed-off-by: Sonu Saha <sonu.saha@progress.com>
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
Co-authored-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Sonu Saha 2023-07-07 08:53:43 +05:30 committed by GitHub
parent c4ba48b36f
commit 50aabd06d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,10 @@ module InspecPlugins::License
ChefLicensing.add_license
rescue ChefLicensing::LicenseKeyFetcher::LicenseKeyAddNotAllowed => e
Inspec::Log.error e.message
Inspec::UI::EXIT_LICENSE_NOT_SET
Inspec::UI.new.exit(Inspec::UI::EXIT_LICENSE_NOT_SET)
rescue ChefLicensing::Error => e
Inspec::Log.error e.message
Inspec::UI.new.exit(Inspec::UI::EXIT_LICENSE_NOT_SET)
end
end
end