Skip to content

Commit

Permalink
Ability to chef license key and chef license server using kitchen inspec
Browse files Browse the repository at this point in the history
Signed-off-by: Nik08 <nikita.mathur@progress.com>
  • Loading branch information
Nik08 committed Sep 13, 2024
1 parent 6a471d1 commit cce4eec
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/kitchen/verifier/inspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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] || []
Expand Down

0 comments on commit cce4eec

Please sign in to comment.