From af7379d0beeceacf0c7806ac1811a472dbc15a3b Mon Sep 17 00:00:00 2001 From: Jos Backus Date: Tue, 20 Oct 2015 13:26:16 -0700 Subject: Route all tags access through Chef::Node#{tags,tag} This should avoid node tags not being initialized properly to an empty Array. --- lib/chef/knife/core/node_presenter.rb | 2 +- lib/chef/recipe.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/chef/knife/core/node_presenter.rb b/lib/chef/knife/core/node_presenter.rb index d9ea8c7669..5192c53f51 100644 --- a/lib/chef/knife/core/node_presenter.rb +++ b/lib/chef/knife/core/node_presenter.rb @@ -125,7 +125,7 @@ ROLES summarized << <<-SUMMARY #{key('Recipes:')} #{Array(node[:recipes]).join(', ')} #{key('Platform:')} #{node[:platform]} #{node[:platform_version]} -#{key('Tags:')} #{Array(node[:tags]).join(', ')} +#{key('Tags:')} #{node.tags.join(', ')} SUMMARY if config[:medium_output] || config[:long_output] summarized +=<<-MORE diff --git a/lib/chef/recipe.rb b/lib/chef/recipe.rb index 83f3f5564b..0f9bf2655b 100644 --- a/lib/chef/recipe.rb +++ b/lib/chef/recipe.rb @@ -98,7 +98,7 @@ class Chef # false:: If any of the parameters are missing def tagged?(*tags) tags.each do |tag| - return false unless run_context.node[:tags].include?(tag) + return false unless run_context.node.tags.include?(tag) end true end @@ -109,10 +109,10 @@ class Chef # tags:: A list of tags # # === Returns - # tags:: The current list of run_context.node[:tags] + # tags:: The current list of run_context.node.tags def untag(*tags) tags.each do |tag| - run_context.node.normal[:tags].delete(tag) + run_context.node.tags.delete(tag) end end -- cgit v1.2.1