Mayank Jain
Mayank Jain

Reputation: 3195

Chef is not picking up my local cookbook

I am writing my first set of cookbooks to install grafana (for StatsD).

However when I do an inlcude_recipe("grafana::default"), a recipe which is not provided by my local cookbooks is picked (I am guessing from upstream).

I am using kitchen.ci to "converge" - the chef run completes successfully.

What am I missing here (or doing wrong)?

My folder structure

/cookbooks
|- /chef-grafana
|-- < folder structure from author of https://github.com/JonathanTron/chef-grafana - I cloned this repo >
|- /my_statsd_graphite_grafana_cookbook
|-- /recipes
|--- default.rb
|-- /attributes
|-- metadata.rb
|-- Berksfile

metadata.rb

name("my_statsd_graphite_grafana_cookbook")
version("1.0")
depends("apt")
depends("statsd")
depends("graphite")
depends("grafana")
recipe("my_statsd_graphite_grafana_cookbook", "StatsD Recipe")

Berksfile

source 'https://supermarket.chef.io'
metadata
cookbook 'apt', git: 'git://github.com/opscode-cookbooks/apt.git'
cookbook 'statsd', git: 'git://github.com/librato/statsd-cookbook.git'
cookbook 'graphite', git: 'git://github.com/hw-cookbooks/graphite.git'
cookbook "grafana", path: "../chef-grafana"

default.rb

include_recipe("apt")

# Solve some deps
install_packages = ["python-pip", "python-dev", "build-essential", "unzip"]
install_packages.each { |install_package|
  package(install_package)
}

# Include statsd recipes
include_recipe("statsd::default")
include_recipe("graphite::packages")
include_recipe("graphite::carbon")

# Include grafana recipes
include_recipe("grafana::default")

I even tried doing many debug logs in the cloned chef-grafana default.rb recipe, but they are never called.

What am I missing?

Thanks so much.

Upvotes: 0

Views: 315

Answers (1)

Dzmitry Savinkou
Dzmitry Savinkou

Reputation: 5190

EDITED

Make sure you have name attribute populated in metadata.rb and have not messed up ~/.berkshelf/config.json and BERKSHELF_PATH .

Upvotes: 0

Related Questions