Search code examples
ubuntuchef-infra

cookstyle: command not found


I'm learning Chef via Udemy, and one of the topics is to test cookbook syntax with cookstyle. I wrote a very simple cookbook and tried to test it with cookstyle:

path/to/Chef# cat test-cookbook.rb

user "spencer" do
  shell '/bin/bash'
  uid '9999'
end

path/to/Chef# cookstyle test-cookbook.rb
cookstyle: command not found

The tutorial is using ChefDK, which I've found is outdated. I used apt install chef as root, which I assume is downloading the workstation, and I tried running cookstyle as root also. Is cookstyle outdated, too?


Solution

  • The chef package contains only some binaries and Chef libraries for the client. Quoting from output of apt info chef command:

    This package provides the chef-client, chef-solo, and knife binaries as well as the Chef library.

    This does not contain the Chef workstation package. Chef workstation can be downloaded from: https://www.chef.io/downloads/tools/workstation.

    The cookstyle command will be available when you install workstation.