0
votes

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.

1
You can omit the ::default and just use include_recipe("grafana") for the default recipes.. I would try with a fully qualified path to the cookbook instead of a relative one to ensure the problem is not from this. You may try to configure kitchen to do verbose logging too to see where it takes the cookbook from.Tensibai
Thanks for the verbose tip. Will try it out.Mayank Jain
Any update ? Maybe a log output to complete the question ?Tensibai

1 Answers

0
votes

EDITED

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