Skip to content

Instantly share code, notes, and snippets.

@cheeseplus
Last active July 16, 2019 21:45
Show Gist options
  • Save cheeseplus/1583c1640f38f042a66b662588f3d8ec to your computer and use it in GitHub Desktop.
Save cheeseplus/1583c1640f38f042a66b662588f3d8ec to your computer and use it in GitHub Desktop.
Chef Infra License Errors in Test-kitchen and Packer

If you're getting errors like:

       +---------------------------------------------+
            Chef License Acceptance
       
       Before you can continue, 2 product licenses
       must be accepted. View the license at
       https://www.chef.io/end-user-license-agreement/
       
       Licenses that need accepting:
         * Chef Infra Client
         * Chef InSpec
       
       Do you accept the 2 product licenses (yes/no)?

Test-kitchen

If you're on test-kitchen < 2.2 and accept the Chef 15 EULA (are a customer or only evaluating)
NOTE: this is future compatible as well

provisioner:
  name: chef_zero
  product_name: chef
  product_version: 15
  client_rb:
    chef_license: accept

If you're on test-kitchen >= 2.2 and accept the Chef 15 EULA (are a customer or only evaluating)

provisioner:
  name: chef_zero
  product_name: chef
  product_version: 15
  chef_license: accept-no-persist

If you don't accept the EULA and want to stick with Chef 14

provisioner:
  name: chef_zero
  product_name: chef
  product_version: 14

Make the above changes to kitchen.yml accordingly.

Packer

Add/edit the execute_command for the Chef provisioners to include the license accceptance flag.

    "provisioners": [
        {
            "type": "chef-solo",
            "execute_command": "{{if .Sudo}}sudo {{end}}chef-client --no-color -c {{.ConfigPath}} -j {{.JsonPath}} --chef-license accept-no-persist",
        }
    ]

More information available at https://www.packer.io/docs/provisioners/chef-client.html#execute_command

Terraform

  provisioner "chef" {
    version        = "15"
    client_options = [ "chef_license 'accept'" ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment