Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

kitchen-nodes Kitchen Driver

A Test Kitchen Provisioner that generates searchable Nodes

Install & Usage Instructions

<a name="installation"></a> Installation

gem install kitchen-nodes

<a name="config"></a> Configuration

Use nodes instead of chef-zero for the kitchen provisioner name.

provisioner:
  name: nodes

<a name="Usage"></a> Usage

Using kitchen-nodes one can expect all previously converged nodes to be represented in a node file and be searchable. For example consider this scenario looking for a primary node in a cluster in order to add a node to join:

require 'timeout'

def search_for_nodes(query, timeout = 120)
  nodes = []
  Timeout::timeout(timeout) do
    nodes = search(:node, query)
    until  nodes.count > 0 && nodes[0].has_key?('ipaddress')
      sleep 5
      nodes = search(:node, query)
    end
  end

  if nodes.count == 0 || !nodes[0].has_key?('ipaddress')
    raise "Unable to find nodes!"
  end

  nodes
end

primary = search_for_nodes("run_list:*couchbase??server* AND platform:#{node['platform']}")
node.normal["couchbase-tests"]["primary_ip"] = primary[0]['ipaddress']

<a name="vagrant"></a> Using with Vagrant

When using kitchen-nodes with the vagrant driver, make sure you add the following to your driver_config:

network:
  - ["private_network", { type: "dhcp" }]

This will add an additional non-NAT NIC to your vagrant box with an IP reachable from the host and other test nodes.

<a name="virtualbox"></a> Why is my ohai ipaddress different from my node ipaddress on vagrant with VirtualBox?

Ohai will pick up the localhost ipaddress on vagrant boxes using virtualbox. To reset the node["ipaddress"] to the reachable ip, add hurry-up-and-test::set_non_nat_vbox_ip to the top of your run_list.

suites:
  - name: my-suite
    run_list:
      - recipe[hurry-up-and-test::set_non_nat_vbox_ip]
      - recipe[cookbook-under-test]

You can add this even if you do not use virtualbox and the recipe will do nothing.