Chef Tutorial
Advanced Chef
Chef Useful Resources
Selected Reading
- Chef - Chef-Client Run
- Chef - Nodes
- Testing Cookbook with Test Kitchen
- Chef - ChefSpec
- Chef - Foodcritic
- Chef - Testing Cookbooks
- Chef - Chef-Shell
- Chef - Chef-Client as Daemon
- Chef - Environment
- Chef - Roles
- Chef - Cookbook Dependencies
- Chef - Cookbooks
- Chef - Solo Setup
- Chef - Knife Setup
- Chef - Test Kitchen Setup
- Chef - Client Setup
- Chef - Workstation Setup
- Chef - Version Control System Setup
- Chef - Architecture
- Chef - Overview
- Chef - Home
Advanced Chef
- Chef - Community Cookbooks
- Chef - Files & Packages
- Chef - Blueprints
- Lightweight Resource Provider
- Chef - Resources
- Chef - Cross-Platform Cookbooks
- Chef - Scripts for Data Bags
- Chef - Data Bags
- Chef - Environment Variable
- Chef - Definition
- Chef - Libraries
- Chef - Ruby Gems with Recipes
- Chef - Plain Ruby with Chef DSL
- Chef - Templates
- Dynamically Configuring Recipes
Chef Useful Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Chef - Foodcritic
Chef - Foodcritic
Writing good cookbooks without any issue is quite a difficult task. But there are ways which can help in identifying the pitfalls. Flagging in Chef Cookbook is possible. Foodcritic is one of the best way of archiving it, which tries to identify possible issues with the logic and style of cookbooks.
Foodcritic Setup
Step 1 − Add Foodcritic gem.
vipin@laptop:~/chef-repo $ subl Gemfile source https://rubygems.org gem foodcritic , ~>2.2.0
Step 2 − Install the gem.
vipin@laptop:~/chef-repo $ bundle install Fetching gem metadata from https://rubygems.org/ ...TRUNCATED OUTPUT... Instalpng foodcritic (2.2.0)
Foodcritic Gem
Step 1 − Run Foodcritic on the cookbook.
vipin@laptop:~/chef-repo $ foodcritic ./cookbooks/<Cookbook Name> FC002: Avoid string interpolation where not required: ./cookbooks/ mysql/attributes/server.rb:220 ...TRUNCATED OUTPUT... FC024: Consider adding platform equivalents: ./cookbooks/<Cookbook Name>/ recipes/server.rb:132
Step 2 − Generate a detailed report.
vipin@laptop:~/chef-repo $ foodcritic -C ./cookbooks/mysql cookbooks/<cookbook Name>/attributes/server.rb FC002: Avoid string interpolation where not required [...] 85| default[ <Cookbook Name> ][ conf_dir ] = "#{mysql[ basedir ]}" [...] cookbooks/<Cookbook Name>/recipes/cpent.rb FC007: Ensure recipe dependencies are reflected in cookbook metadata 40| end 41|when "mac_os_x" 42| include_recipe homebrew 43|end 44|
Working Method
Foodcritic defines a set of rules and checks recipe agents, each one of them. It comes with multiple rules concerning various areas: styles, connectedness, attributes, string, probabipty, search, services, files, metadata, and so on.
Advertisements