Skip to content

Commit

Permalink
add hab license acceptance to hab command
Browse files Browse the repository at this point in the history
Signed-off-by: Corey Hemminger <[email protected]>
  • Loading branch information
Stromweld committed Feb 5, 2025
1 parent a003157 commit 8b56948
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/kitchen/provisioner/chef_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -746,10 +746,11 @@ def chef_bin_path
# If no binlinked chef-client binary is found then check for habiatat installed chef-client
# If no habitat installed chef-client is found then check for omnibus installed chef-client
# all fails raise an error
hab_pkg_cmd = "HAB_LICENSE='accept-no-persist' #{config[:hab_binary]} pkg"
if which("chef-client")
windows_os? ? File.dirname(which("chef-client")) : File.dirname(File.readlink(which("chef-client")))
elsif File.exist?(config[:hab_binary]) && ShellOut.run_command("#{config[:hab_binary]} pkg list chef/chef-infra-client").include?("chef/chef-infra-client")
remote_path_join(%W{#{ShellOut.run_command("#{config[:hab_binary]} pkg path chef/chef-infra-client").split("\n").first} bin})
elsif File.exist?(config[:hab_binary]) && ShellOut.run_command("#{hab_pkg_cmd} list chef/chef-infra-client").include?("chef/chef-infra-client")
remote_path_join(%W{#{ShellOut.run_command("#{hab_pkg_cmd} path chef/chef-infra-client").split("\n").first} bin})
elsif Dir.exist?(config[:chef_omnibus_root])
remote_path_join(%W{#{config[:chef_omnibus_root]} bin})
else
Expand Down

0 comments on commit 8b56948

Please sign in to comment.