Provide logger to license-acceptance for help debugging in the future (#3958)

Provide logger to license-acceptance for help debugging in the future
This commit is contained in:
Clinton Wolfe 2019-04-25 18:33:16 -04:00 committed by GitHub
commit db129be2b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View file

@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
spec.add_dependency 'train-aws', '~> 0.1' spec.add_dependency 'train-aws', '~> 0.1'
# Implementation dependencies # Implementation dependencies
spec.add_dependency 'license-acceptance', '~> 0.2' spec.add_dependency 'license-acceptance', '>= 0.2.13', '< 2.0'
spec.add_dependency 'thor', '~> 0.20' spec.add_dependency 'thor', '~> 0.20'
spec.add_dependency 'json', '>= 1.8', '< 3.0' spec.add_dependency 'json', '>= 1.8', '< 3.0'
spec.add_dependency 'method_source', '~> 0.8' spec.add_dependency 'method_source', '~> 0.8'

View file

@ -392,7 +392,11 @@ require 'license_acceptance/acceptor'
begin begin
if (commands_exempt_from_license_check & ARGV.map(&:downcase)).empty? && # Did they use a non-exempt command? if (commands_exempt_from_license_check & ARGV.map(&:downcase)).empty? && # Did they use a non-exempt command?
!ARGV.empty? # Did they supply at least one command? !ARGV.empty? # Did they supply at least one command?
LicenseAcceptance::Acceptor.check_and_persist('inspec', Inspec::VERSION) LicenseAcceptance::Acceptor.check_and_persist(
'inspec',
Inspec::VERSION,
logger: Inspec::Log,
)
end end
rescue LicenseAcceptance::LicenseNotAcceptedError rescue LicenseAcceptance::LicenseNotAcceptedError
Inspec::Log.error 'InSpec cannot execute without accepting the license' Inspec::Log.error 'InSpec cannot execute without accepting the license'