Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic
-
Upload
hart-hoover -
Category
Technology
-
view
1.983 -
download
4
description
Transcript of Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic
![Page 1: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/1.jpg)
CLOUD SAVVY
BROWN BAG:Rapid Chef
Development
Hart Hoover@hhoover
![Page 2: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/2.jpg)
CLOUD SAVVY 2
![Page 3: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/3.jpg)
CLOUD SAVVY 3
ENTERPRISE
![Page 4: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/4.jpg)
CLOUD SAVVY 4
CHEF SOLO
![Page 5: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/5.jpg)
CLOUD SAVVY 5OPEN SOURCE CHEF
![Page 6: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/6.jpg)
CLOUD SAVVY
TOOLS!
6
![Page 7: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/7.jpg)
CLOUD SAVVY
TOOLS!
6
• Git/GitHub
![Page 8: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/8.jpg)
CLOUD SAVVY
TOOLS!
6
• Git/GitHub
• Berkshelf
![Page 9: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/9.jpg)
CLOUD SAVVY
TOOLS!
6
• Git/GitHub
• Berkshelf
• Vagrant
![Page 10: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/10.jpg)
CLOUD SAVVY
TOOLS!
6
• Git/GitHub
• Berkshelf
• Vagrant
• Vagrant Plugins
![Page 11: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/11.jpg)
CLOUD SAVVY
TOOLS!
6
• Git/GitHub
• Berkshelf
• Vagrant
• Vagrant Plugins
• Test Kitchen
![Page 12: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/12.jpg)
CLOUD SAVVY
TOOLS!
6
• Git/GitHub
• Berkshelf
• Vagrant
• Vagrant Plugins
• Test Kitchen
• Foodcritic
![Page 13: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/13.jpg)
CLOUD SAVVY 7
![Page 14: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/14.jpg)
CLOUD SAVVY 8
![Page 15: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/15.jpg)
CLOUD SAVVY 8
![Page 16: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/16.jpg)
CLOUD SAVVY 8
![Page 17: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/17.jpg)
CLOUD SAVVY 8
• A CLI Tool
• A Source Code Management Tool
• A Package Manager
• Replaces parts of knife
• Specifically cookbook management
![Page 18: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/18.jpg)
CLOUD SAVVY 8
• A CLI Tool
• A Source Code Management Tool
• A Package Manager
• Replaces parts of knife
• Specifically cookbook management
THE BERKSHELF WAY IS BETTER
![Page 19: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/19.jpg)
CLOUD SAVVY 9
![Page 20: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/20.jpg)
CLOUD SAVVY 10
![Page 21: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/21.jpg)
CLOUD SAVVY 11
Why Vagrant?
• Repeatable• Customizable• “It works on my machine.”
Developers
![Page 22: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/22.jpg)
CLOUD SAVVY 12
Why Vagrant?
• Disposable Machines• Test your provisioning• Local → Production
Operations
![Page 23: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/23.jpg)
CLOUD SAVVY 13
Why Vagrant?
=
![Page 24: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/24.jpg)
CLOUD SAVVY 14
TEST KITCHEN
Convergence Integration Testing
for Chef
![Page 25: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/25.jpg)
CLOUD SAVVY 14
TEST KITCHEN
Convergence Integration Testing
for Chef
Does my cookbook work?
![Page 26: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/26.jpg)
CLOUD SAVVY 14
TEST KITCHEN
Convergence Integration Testing
for Chef
Does my cookbook work?
NO
![Page 27: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/27.jpg)
CLOUD SAVVY 15
FoodCritic
Lint testing!
Makes it easy to flagknown issues
Better Cookbooks!
![Page 28: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/28.jpg)
CLOUD SAVVY
ChefWorkFlowS
![Page 29: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/29.jpg)
CLOUD SAVVY
OLD CHEF DEV WORKFLOW
17
![Page 30: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/30.jpg)
CLOUD SAVVY
OLD CHEF DEV WORKFLOW
17
EditCookbook
![Page 31: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/31.jpg)
CLOUD SAVVY
OLD CHEF DEV WORKFLOW
17
EditCookbook
UploadCookbook
![Page 32: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/32.jpg)
CLOUD SAVVY
OLD CHEF DEV WORKFLOW
17
EditCookbook
ProvisionMachine
UploadCookbook
![Page 33: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/33.jpg)
CLOUD SAVVY
OLD CHEF DEV WORKFLOW
17
EditCookbook
ProvisionMachine
BootstrapMachine
UploadCookbook
![Page 34: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/34.jpg)
CLOUD SAVVY
OLD CHEF DEV WORKFLOW
17
EditCookbook
ProvisionMachine
BootstrapMachine
UploadCookbook
RunChef Client
![Page 35: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/35.jpg)
CLOUD SAVVY
OLD CHEF DEV WORKFLOW
17
EditCookbook
ProvisionMachine
BootstrapMachine
SSH & Validate
UploadCookbook
RunChef Client
![Page 36: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/36.jpg)
CLOUD SAVVY
OLD CHEF DEV WORKFLOW
17
EditCookbook
ProvisionMachine
BootstrapMachine
SSH & Validate
UploadCookbook
RunChef Client
![Page 37: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/37.jpg)
CLOUD SAVVY
NEW CHEF DEV WORKFLOW
18
EditCookbook
VagrantUp
TestKitchen
![Page 38: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/38.jpg)
CLOUD SAVVY
Our Workflow
19
Berkshelf VagrantUp
TestKitchen GitHub Production Monitoring
![Page 39: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/39.jpg)
CLOUD SAVVY
Our Workflow
19
Berkshelf VagrantUp
TestKitchen GitHub Production Monitoring
![Page 40: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/40.jpg)
CLOUD SAVVY
Our Workflow
19
{DEV
Berkshelf VagrantUp
TestKitchen GitHub Production Monitoring
![Page 41: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/41.jpg)
CLOUD SAVVY
Our Workflow
19
{DEV OPS{Berkshelf Vagrant
UpTest
Kitchen GitHub Production Monitoring
![Page 42: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/42.jpg)
CLOUD SAVVY
DevelopmentWalkthroughPrerequisites
![Page 43: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/43.jpg)
CLOUD SAVVY
What You need• VirtualBox • Vagrant• Opscode’s 12.04 Vagrant Box• Ruby (1.9.3 or higher!)
• Berkshelf• Test Kitchen• Foodcritic
21
![Page 44: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/44.jpg)
CLOUD SAVVY
Virtualbox
22
https://www.virtualbox.org/wiki/Downloads
![Page 45: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/45.jpg)
CLOUD SAVVY
Vagrant
23
http://downloads.vagrantup.com
![Page 46: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/46.jpg)
CLOUD SAVVY
OPSCODE’S VAGRANT BOX
24
$ vagrant box add \opscode-‐ubuntu-‐12.04 \http://tinyurl.com/chef1204
![Page 47: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/47.jpg)
CLOUD SAVVY
CREATE A PROJECT
25
$ mkdir -‐p ~/projects/chefnovaclient
$ cd ~/projects/chefnovaclient
![Page 48: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/48.jpg)
CLOUD SAVVY
Berkshelf
26
$ gem install berkshelf
![Page 49: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/49.jpg)
CLOUD SAVVY
Test Kitchen
27
$ gem install test-‐kitchen -‐-‐pre
![Page 50: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/50.jpg)
CLOUD SAVVY
FoodCritic
28
$ gem install foodcritic
![Page 51: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/51.jpg)
CLOUD SAVVY 29
![Page 52: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/52.jpg)
CLOUD SAVVY
DevelopmentWalkthrough
rackspace-novaclient&
supernova
![Page 53: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/53.jpg)
CLOUD SAVVY
GET STARTED
31
$ berks init
$ cd ~/projects/chefnovaclient
![Page 54: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/54.jpg)
CLOUD SAVVY 32
$ berks initberks init create Berksfile create Thorfile create .gitignore run git init from "." create Gemfile create .kitchen.yml append Thorfile create test/integration/default append .gitignore append .gitignore append Gemfile append GemfileYou must run `bundle install' to fetch any new gems. create VagrantfileSuccessfully initialized
![Page 55: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/55.jpg)
CLOUD SAVVY 33
$ berks initberks init create Berksfile create Thorfile create .gitignore run git init from "." create Gemfile create .kitchen.yml append Thorfile create test/integration/default append .gitignore append .gitignore append Gemfile append GemfileYou must run `bundle install' to fetch any new gems. create VagrantfileSuccessfully initialized
![Page 56: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/56.jpg)
CLOUD SAVVY 34
$ berks initberks init create Berksfile create Thorfile create .gitignore run git init from "." create Gemfile create .kitchen.yml append Thorfile create test/integration/default append .gitignore append .gitignore append Gemfile append GemfileYou must run `bundle install' to fetch any new gems. create VagrantfileSuccessfully initialized
![Page 57: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/57.jpg)
CLOUD SAVVY 35
$ berks initberks init create Berksfile create Thorfile create .gitignore run git init from "." create Gemfile create .kitchen.yml append Thorfile create test/integration/default append .gitignore append .gitignore append Gemfile append GemfileYou must run `bundle install' to fetch any new gems. create VagrantfileSuccessfully initialized
![Page 58: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/58.jpg)
CLOUD SAVVY 36
$ berks initberks init create Berksfile create Thorfile create .gitignore run git init from "." create Gemfile create .kitchen.yml append Thorfile create test/integration/default append .gitignore append .gitignore append Gemfile append GemfileYou must run `bundle install' to fetch any new gems. create VagrantfileSuccessfully initialized
![Page 59: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/59.jpg)
CLOUD SAVVY 37
$ berks initberks init create Berksfile create Thorfile create .gitignore run git init from "." create Gemfile create .kitchen.yml append Thorfile create test/integration/default append .gitignore append .gitignore append Gemfile append GemfileYou must run `bundle install' to fetch any new gems. create VagrantfileSuccessfully initialized
![Page 60: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/60.jpg)
CLOUD SAVVY 38
$ berks initberks init create Berksfile create Thorfile create .gitignore run git init from "." create Gemfile create .kitchen.yml append Thorfile create test/integration/default append .gitignore append .gitignore append Gemfile append GemfileYou must run `bundle install' to fetch any new gems. create VagrantfileSuccessfully initialized
![Page 61: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/61.jpg)
CLOUD SAVVY 39
![Page 62: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/62.jpg)
CLOUD SAVVY
INSTALL Kitchen-Vagrant
40
$ gem install kitchen-‐vagrant
![Page 63: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/63.jpg)
CLOUD SAVVY
SET UP TEST KITCHEN
41
Goodbye10.04!
![Page 64: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/64.jpg)
CLOUD SAVVY
RUN Test KitchEN
42
Good Luck!
$ kitchen verify
![Page 65: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/65.jpg)
CLOUD SAVVY 43
![Page 66: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/66.jpg)
CLOUD SAVVY
WHAT FAILED?
44
FATAL: No cookbook found
![Page 67: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/67.jpg)
CLOUD SAVVY
What are our requirements?
45
![Page 68: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/68.jpg)
CLOUD SAVVY
What are our requirements?
45
Python
pippackage manager
make
setuptools
![Page 69: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/69.jpg)
CLOUD SAVVY
COPY/PasTE
46
http://tinyurl.com/chefpart2
![Page 70: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/70.jpg)
CLOUD SAVVY
BERKSFILE: DependencIES!
47
site :opscode
cookbook 'apt'cookbook 'build-‐essential'cookbook 'python'
![Page 71: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/71.jpg)
CLOUD SAVVY
RUN Test KitchEN
48
Good Luck!
$ kitchen converge
![Page 72: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/72.jpg)
CLOUD SAVVY 49
Congrats!
You installed something...
![Page 73: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/73.jpg)
CLOUD SAVVY 49
Congrats!
You installed something...
but not what we need.
![Page 74: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/74.jpg)
CLOUD SAVVY
BERKSFILE:THIS IS A COOKBOOK
50
site :opscode
cookbook 'apt'cookbook 'build-‐essential'cookbook 'python'metadata
![Page 75: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/75.jpg)
CLOUD SAVVY
BERKSFILE:THIS IS A COOKBOOK
51
site :opscode
cookbook 'apt'cookbook 'build-‐essential'cookbook 'python'metadata
![Page 76: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/76.jpg)
CLOUD SAVVY
RUN Test KitchEN
52
Good Luck!
$ kitchen converge
![Page 77: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/77.jpg)
CLOUD SAVVY 53
![Page 78: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/78.jpg)
CLOUD SAVVY
WHAT FAILED?
54
Failed to complete #converge action
![Page 79: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/79.jpg)
CLOUD SAVVY
metadata.RB:What is this THING??
55
name "chefnovaclient"version "1.0.0"description "Installs the novaclient."maintainer "Hart Hoover"maintainer_email "[email protected]"
depends "python"depends "apt"
supports "ubuntu"
![Page 80: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/80.jpg)
CLOUD SAVVY
RUN Test KitchEN
56
Good Luck!
$ kitchen converge
![Page 81: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/81.jpg)
CLOUD SAVVY 57
Congrats!
You installed something...
![Page 82: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/82.jpg)
CLOUD SAVVY 57
Congrats!
You installed something...
but STILL not what we need.
![Page 83: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/83.jpg)
CLOUD SAVVY
TIME TO WRITE RECIPES
58
![Page 84: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/84.jpg)
CLOUD SAVVY
TIME TO WRITE RECIPES
59
$ berks cookbook .
Don’t overwrite stuff
![Page 85: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/85.jpg)
CLOUD SAVVY
Default RECIPE:recipes/default.rb
60
include_recipe "apt"include_recipe "python::pip"
%w{git python-‐dev build-‐essential}.each do |pkg| package pkg do action :install endend
python_pip "rackspace-‐novaclient" do action :installend
![Page 86: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/86.jpg)
CLOUD SAVVY 61
include_recipe "apt"include_recipe "python::pip"
%w{git python-‐dev build-‐essential}.each do |pkg| package pkg do action :install endend
python_pip "rackspace-‐novaclient" do action :installend
Default RECIPE:recipes/default.rb
![Page 87: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/87.jpg)
CLOUD SAVVY 62
include_recipe "apt"include_recipe "python::pip"
%w{git python-‐dev build-‐essential}.each do |pkg| package pkg do action :install endend
python_pip "rackspace-‐novaclient" do action :installend
Default RECIPE:recipes/default.rb
![Page 88: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/88.jpg)
CLOUD SAVVY 63
include_recipe "apt"include_recipe "python::pip"
%w{git python-‐dev build-‐essential}.each do |pkg| package pkg do action :install endend
python_pip "rackspace-‐novaclient" do action :installend
Default RECIPE:recipes/default.rb
![Page 89: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/89.jpg)
CLOUD SAVVY
EDIT YOUR RUN LIST
64
suites:-‐ name: default run_list: -‐ recipe[chefnovaclient::default] attributes: {}
.kitchen.yaml
![Page 90: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/90.jpg)
CLOUD SAVVY
EDIT YOUR RUN LIST
65
suites:-‐ name: default run_list: -‐ recipe[chefnovaclient::default] attributes: {}
.kitchen.yaml
![Page 91: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/91.jpg)
CLOUD SAVVY
RUN FOODCRITIC!
66
$ foodcritic .
Everything good?
![Page 92: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/92.jpg)
CLOUD SAVVY 67
FIX IT!
If Not:
![Page 93: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/93.jpg)
CLOUD SAVVY
RUN Test KitchEN
68
Good Luck!
$ kitchen converge
![Page 94: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/94.jpg)
CLOUD SAVVY
Did it work?
69
$ kitchen login default$ nova help
![Page 95: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/95.jpg)
CLOUD SAVVY 70
![Page 96: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/96.jpg)
CLOUD SAVVY 71
![Page 97: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/97.jpg)
CLOUD SAVVY 72
SUPERNOVA
![Page 98: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/98.jpg)
CLOUD SAVVY
Let’s MAKE AUTOMATED TESTs
73
$ mkdir test/integration/default/bats
$ touch test/integration/default/bats/supernova.bats
![Page 99: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/99.jpg)
CLOUD SAVVY
TESTING
74
test/integration/default/bats/supernova.bats
#!/usr/bin/env bats
@test "supernova is installed" { which supernova}
![Page 100: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/100.jpg)
CLOUD SAVVY 75
@test "supernova config exists" { cat /home/vagrant/.supernova}
TESTINGtest/integration/default/bats/supernova.bats
![Page 101: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/101.jpg)
CLOUD SAVVY 76
@test "run supernova" { supernova myaccount list}
TESTINGtest/integration/default/bats/supernova.bats
![Page 102: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/102.jpg)
CLOUD SAVVY 77
@test "novaclient installed" { which nova}
TESTINGtest/integration/default/bats/supernova.bats
![Page 103: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/103.jpg)
CLOUD SAVVY
SUPERNOVA
78
recipes/default.rb
python_pip "git+git://github.com/major/supernova.git" do action :installend
template "/home/vagrant/.supernova" do source "supernova.erb" mode 0600 owner "vagrant" group "vagrant"end
![Page 104: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/104.jpg)
CLOUD SAVVY
SuperNova
79
templates/default/supernova.erb[myaccount]OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/OS_VERSION=2.0OS_AUTH_SYSTEM=rackspaceOS_REGION_NAME=DFWOS_SERVICE_NAME=cloudserversOpenStackOS_TENANT_NAME=<%= node['chefnovaclient']['username'] %>OS_USERNAME=<%= node['chefnovaclient']['username'] %>OS_PASSWORD=<%= node['chefnovaclient']['password'] %>OS_NO_CACHE=1NOVA_VOLUME_SERVICE_NAME=cloudBlockStorage
![Page 105: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/105.jpg)
CLOUD SAVVY
SuperNova
80
templates/default/supernova.erb[myaccount]OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/OS_VERSION=2.0OS_AUTH_SYSTEM=rackspaceOS_REGION_NAME=DFWOS_SERVICE_NAME=cloudserversOpenStackOS_TENANT_NAME=<%= node['chefnovaclient']['username'] %>OS_USERNAME=<%= node['chefnovaclient']['username'] %>OS_PASSWORD=<%= node['chefnovaclient']['password'] %>OS_NO_CACHE=1NOVA_VOLUME_SERVICE_NAME=cloudBlockStorage
![Page 106: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/106.jpg)
CLOUD SAVVY
SuperNova
81
attributes/default.rb
default['chefnovaclient']['username'] = "USERNAME"default['chefnovaclient']['password'] = "APIKEY"
![Page 107: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/107.jpg)
CLOUD SAVVY
RUN FOODCRITIC!
82
$ foodcritic .
Everything good?
![Page 108: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/108.jpg)
CLOUD SAVVY
RUN Test KitchEN
83
Good Luck!
$ kitchen converge
![Page 109: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/109.jpg)
CLOUD SAVVY
RUN YOUR Tests
84
Good Luck!
$ kitchen verify
![Page 110: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/110.jpg)
CLOUD SAVVY
“SAVE YOUR WORK”
85
![Page 111: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic](https://reader034.fdocument.pub/reader034/viewer/2022042714/554a3306b4c90526578b5510/html5/thumbnails/111.jpg)
CLOUD SAVVY
THANKYOU!