diff options
author | Sean Walberg <sean@ertw.com> | 2015-04-05 00:10:57 -0500 |
---|---|---|
committer | Sean Walberg <sean@ertw.com> | 2015-04-05 00:10:57 -0500 |
commit | 4cdce72a39b6f2e9ad0eb3029d861c99494738f0 (patch) | |
tree | 7da84564e60bee3eef0f0266d818d6230cf98219 /spec/unit/knife/bootstrap/client_builder_spec.rb | |
parent | 361ba778a36b9da6e29ece85c124babcbfaabdd8 (diff) | |
download | chef-4cdce72a39b6f2e9ad0eb3029d861c99494738f0.tar.gz |
Allow tags to be set on a node during bootstrap
I can set attributes, environment, and run_list, but why not tags?
Some of our recipes are driven off of tags, such as for sudo access or
membership in a load balancing pool.
If this patch is accepted then I will add the corresponding feature to
knife-vsphere.
This patch only works with the new vault method, not the validator key
method. If someone has some pointers on where to add it in the validator
method I'd be happy to amend.
Diffstat (limited to 'spec/unit/knife/bootstrap/client_builder_spec.rb')
-rw-r--r-- | spec/unit/knife/bootstrap/client_builder_spec.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/unit/knife/bootstrap/client_builder_spec.rb b/spec/unit/knife/bootstrap/client_builder_spec.rb index e6aa307c7e..930ae8c9d3 100644 --- a/spec/unit/knife/bootstrap/client_builder_spec.rb +++ b/spec/unit/knife/bootstrap/client_builder_spec.rb @@ -149,6 +149,22 @@ describe Chef::Knife::Bootstrap::ClientBuilder do client_builder.run end + it "does not add tags by default" do + allow(node).to receive(:run_list).with([]) + expect(node).to_not receive(:tags) + client_builder.run + end + + it "adds tags to the node when given" do + tag_receiver = [] + + knife_config[:tags] = %w[foo bar] + allow(node).to receive(:run_list).with([]) + allow(node).to receive(:tags).and_return(tag_receiver) + client_builder.run + expect(tag_receiver).to eq %w[foo bar] + end + it "builds a node when the run_list is a string" do knife_config[:run_list] = "role[base],role[app]" expect(node).to receive(:run_list).with(["role[base]", "role[app]"]) |