Skip to content

Instantly share code, notes, and snippets.

@Maniacal
Created July 23, 2015 17:48
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 Maniacal/2d2f2d819914fca5953d to your computer and use it in GitHub Desktop.
Save Maniacal/2d2f2d819914fca5953d to your computer and use it in GitHub Desktop.
I have this code that finds seed nodes:
def cassandra_seeds
nodes = search(
:node, "pds_cassandra_cluster_name:\
#{node['pds_cassandra']['cluster_name']}\
AND tags:*seed_node*"
)
seeds = Set.new
nodes.each do |data|
seeds.merge([data['ipaddress']])
end
seeds.to_a
end
I've tried mocking it but no luck:
ChefSpec::ServerRunner.new do |node|
node.automatic['ipaddress'] = '192.168.50.100'
node.normal['tags'] = ['seed_node']
end.converge(described_recipe)
I've also tried node.set['tags'] (instead of .normal) but no luck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment