rapid chef development with berkshelf, test-kitchen and foodcritic

111
CLOUD SAVVY BROWN BAG: Rapid Chef Development Hart Hoover @hhoover

Upload: hart-hoover

Post on 06-May-2015

1.984 views

Category:

Technology


4 download

DESCRIPTION

An introduction to Chef Cookbook development tools: * Berkshelf * Test-Kitchen * Foodcritic

TRANSCRIPT

Page 1: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

BROWN BAG:Rapid Chef

Development

Hart Hoover@hhoover

Page 2: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 2

Page 3: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 3

ENTERPRISE

Page 4: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 4

CHEF SOLO

Page 5: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 5OPEN SOURCE CHEF

Page 6: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TOOLS!

6

Page 7: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TOOLS!

6

• Git/GitHub

Page 8: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TOOLS!

6

• Git/GitHub

• Berkshelf

Page 9: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TOOLS!

6

• Git/GitHub

• Berkshelf

• Vagrant

Page 10: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TOOLS!

6

• Git/GitHub

• Berkshelf

• Vagrant

• Vagrant Plugins

Page 11: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TOOLS!

6

• Git/GitHub

• Berkshelf

• Vagrant

• Vagrant Plugins

• Test Kitchen

Page 12: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TOOLS!

6

• Git/GitHub

• Berkshelf

• Vagrant

• Vagrant Plugins

• Test Kitchen

• Foodcritic

Page 13: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 7

Page 14: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 8

Page 15: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 8

Page 16: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 8

Page 17: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

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

CLOUD SAVVY 9

Page 20: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 10

Page 21: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 11

Why Vagrant?

• Repeatable• Customizable• “It works on my machine.”

Developers

Page 22: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 12

Why Vagrant?

• Disposable Machines• Test your provisioning• Local → Production

Operations

Page 23: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 13

Why Vagrant?

=

Page 24: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 14

TEST KITCHEN

Convergence Integration Testing

for Chef

Page 25: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

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

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

CLOUD SAVVY

ChefWorkFlowS

Page 29: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

OLD CHEF DEV WORKFLOW

17

Page 30: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

OLD CHEF DEV WORKFLOW

17

EditCookbook

Page 31: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

OLD CHEF DEV WORKFLOW

17

EditCookbook

UploadCookbook

Page 32: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

OLD CHEF DEV WORKFLOW

17

EditCookbook

ProvisionMachine

UploadCookbook

Page 33: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

OLD CHEF DEV WORKFLOW

17

EditCookbook

ProvisionMachine

BootstrapMachine

UploadCookbook

Page 34: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

OLD CHEF DEV WORKFLOW

17

EditCookbook

ProvisionMachine

BootstrapMachine

UploadCookbook

RunChef Client

Page 35: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

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

CLOUD SAVVY

NEW CHEF DEV WORKFLOW

18

EditCookbook

VagrantUp

TestKitchen

Page 38: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

Our Workflow

19

Berkshelf VagrantUp

TestKitchen GitHub Production Monitoring

Page 39: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

Our Workflow

19

Berkshelf VagrantUp

TestKitchen GitHub Production Monitoring

Page 40: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

Our Workflow

19

{DEV

Berkshelf VagrantUp

TestKitchen GitHub Production Monitoring

Page 41: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

CLOUD SAVVY

DevelopmentWalkthroughPrerequisites

Page 43: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

CLOUD SAVVY

Virtualbox

22

https://www.virtualbox.org/wiki/Downloads

Page 45: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

Vagrant

23

http://downloads.vagrantup.com

Page 46: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

CLOUD SAVVY

CREATE A PROJECT

25

$  mkdir  -­‐p  ~/projects/chefnovaclient

$  cd  ~/projects/chefnovaclient

Page 48: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

Berkshelf

26

$  gem  install  berkshelf

Page 49: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

Test Kitchen

27

$  gem  install  test-­‐kitchen  -­‐-­‐pre

Page 50: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

FoodCritic

28

$  gem  install  foodcritic

Page 51: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 29

Page 52: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

DevelopmentWalkthrough

rackspace-novaclient&

supernova

Page 53: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

GET STARTED

31

$  berks  init

$  cd  ~/projects/chefnovaclient

Page 54: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

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

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

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

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

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

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

CLOUD SAVVY 39

Page 62: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

INSTALL Kitchen-Vagrant

40

$  gem  install  kitchen-­‐vagrant

Page 63: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

SET UP TEST KITCHEN

41

Goodbye10.04!

Page 64: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

RUN Test KitchEN

42

Good Luck!

$  kitchen  verify

Page 65: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 43

Page 66: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

WHAT FAILED?

44

FATAL:  No  cookbook  found

Page 67: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

What are our requirements?

45

Page 68: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

What are our requirements?

45

Python

pippackage manager

make

setuptools

Page 69: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

COPY/PasTE

46

http://tinyurl.com/chefpart2

Page 70: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

CLOUD SAVVY

RUN Test KitchEN

48

Good Luck!

$  kitchen  converge

Page 72: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 49

Congrats!

You installed something...

Page 73: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 49

Congrats!

You installed something...

but not what we need.

Page 74: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

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

CLOUD SAVVY

RUN Test KitchEN

52

Good Luck!

$  kitchen  converge

Page 77: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 53

Page 78: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

WHAT FAILED?

54

Failed  to  complete  #converge  action

Page 79: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

CLOUD SAVVY

RUN Test KitchEN

56

Good Luck!

$  kitchen  converge

Page 81: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 57

Congrats!

You installed something...

Page 82: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 57

Congrats!

You installed something...

but STILL not what we need.

Page 83: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TIME TO WRITE RECIPES

58

Page 84: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

TIME TO WRITE RECIPES

59

$  berks  cookbook  .

Don’t overwrite stuff

Page 85: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

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

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

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

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

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

CLOUD SAVVY

RUN FOODCRITIC!

66

$  foodcritic  .

Everything good?

Page 92: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 67

FIX IT!

If Not:

Page 93: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

RUN Test KitchEN

68

Good Luck!

$  kitchen  converge

Page 94: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

Did it work?

69

$  kitchen  login  default$  nova  help

Page 95: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 70

Page 96: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 71

Page 97: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY 72

SUPERNOVA

Page 98: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

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

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

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

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

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

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

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

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

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

CLOUD SAVVY

RUN FOODCRITIC!

82

$  foodcritic  .

Everything good?

Page 108: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

RUN Test KitchEN

83

Good Luck!

$  kitchen  converge

Page 109: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

RUN YOUR Tests

84

Good Luck!

$  kitchen  verify

Page 110: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

“SAVE YOUR WORK”

85

Page 111: Rapid Chef Development with Berkshelf, Test-Kitchen and Foodcritic

CLOUD SAVVY

THANKYOU!