Difference between 'knife cookbook create' and 'chef generate cookbook'?

14,292

knife cookbook create is the legacy way to create a cookbook, it builds the structure of a cookbook with all possible directories.

chef generate cookbook is part of Chef-DK and aims at generating a testable cookbook structure with minimal directories to use in test-kitchen.

Both can be tweaked, the chef generate is easiest to tweak as the command has been written in this way to allow all to build the cookbook structure that better fits their needs.

Share:
14,292

Related videos on Youtube

cbron
Author by

cbron

Updated on September 16, 2022

Comments

  • cbron
    cbron over 1 year

    I'm struggling with the chef learning curve. What is the difference between these two commands, and why are there two of them ?

    knife cookbook: The knife cookbook subcommand is used to interact with cookbooks that are located on the Chef server or the local chef-repo.

    $ knife cookbook create a_knife_cookbook
    $ ls -a
      CHANGELOG.md 
      README.md    
      attributes
      definitions
      files
      libraries
      metadata.rb
      providers
      recipes
      resources
      templates
    

    chef generate cookbook: The chef generate cookbook subcommand is used to generate a cookbook.

    $ chef generate cookbook a_chef_cookbook
    $ ls -a
      .gitignore
      .kitchen.yml
      Berksfile
      README.md
      chefignore
      metadata.rb
      recipes
      spec
      test