Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save atheiman/3f132143ca46b34a9d6cd3b7e82368b2 to your computer and use it in GitHub Desktop.
Save atheiman/3f132143ca46b34a9d6cd3b7e82368b2 to your computer and use it in GitHub Desktop.
# chef-nodes is useful to share a nodes attributes with other nodes. if you want to share _converged_ node
# data (more than just ip and hostname from chef-nodes) then you can use test-kitchen >= 1.20.0 which adds
# support for downloading files from nodes after converge via .kitchen.yml:
#
# provisioner:
# nodes_path: test/fixtures/nodes
# downloads:
# /tmp/kitchen/nodes: test/fixtures/
#
# this will download node data after converge and drop it into test/fixtures/nodes/node-a.json, node-b.json, etc
# all these files will be uploaded to the next node to converge by chef-nodes.
# unfortunately chef-nodes resets these node files when a converge starts by default. this patch will disable that:
require 'kitchen/provisioner/chef_zero'
module Kitchen
module Provisioner
# Patch kitchen-nodes to not delete node files before converge. This
# ensures all node files will be uploaded during concurrent provisions.
# https://github.com/mwrock/kitchen-nodes/blob/master/lib/kitchen/provisioner/nodes.rb
class Nodes < ChefZero
def create_sandbox
create_node
ensure
super
end
end
end
end
# you can do the same thing with data_bags. for example if node-a modifies a data bag item then
# node-b has to read from it, just specify to also download data_bags from nodes after converge:
#
# provisioner:
# name: nodes
# data_bags_path: test/fixtures/data_bags
# downloads:
# /tmp/kitchen/data_bags: test/fixtures/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment