From cce4eec36970e087007cdb89c761fb5bd955b6d8 Mon Sep 17 00:00:00 2001 From: Nik08 Date: Fri, 13 Sep 2024 16:35:53 +0530 Subject: [PATCH] Ability to chef license key and chef license server using kitchen inspec Signed-off-by: Nik08 --- lib/kitchen/verifier/inspec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/kitchen/verifier/inspec.rb b/lib/kitchen/verifier/inspec.rb index 01fba82..28fed3d 100644 --- a/lib/kitchen/verifier/inspec.rb +++ b/lib/kitchen/verifier/inspec.rb @@ -83,6 +83,8 @@ def call(state) # add inputs and waivers setup_inputs(opts, config) setup_waivers(opts, config) + # Configure Chef License Key and URL through kitchen + setup_chef_license_config(opts, config) # setup Inspec ::Inspec::Log.init(STDERR) @@ -116,6 +118,14 @@ def call(state) private + def setup_chef_license_config(opts, config) + # Pass chef_license_key to inspec if it is set + # Pass chef_license_server to inspec if it is set + chef_license_key = config[:chef_license_key] || ENV["CHEF_LICENSE_KEY"] + opts[:chef_license_key] = chef_license_key if chef_license_key + opts[:chef_license_server] = config[:chef_license_server] if config[:chef_license_server] + end + def setup_waivers(opts, config) # InSpec expects the singular inflection opts[:waiver_file] = config[:waiver_files] || []