summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2015-11-12 10:07:30 +0000
committerThom May <thom@may.lt>2015-11-12 10:07:30 +0000
commitf4a47f9e248d99fe6c284bcbff7c2b05d6dd0484 (patch)
tree0775ce6882d47f093201a57f49ee65fde6941e25 /lib
parentb0dbe243d469cc36477ba8102b74a8456b6f276d (diff)
parentaf7379d0beeceacf0c7806ac1811a472dbc15a3b (diff)
downloadchef-f4a47f9e248d99fe6c284bcbff7c2b05d6dd0484.tar.gz
Merge pull request #4064 from josb/master
Use the initializer to avoid NoMethodError on nil.include?
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/knife/core/node_presenter.rb2
-rw-r--r--lib/chef/node.rb8
-rw-r--r--lib/chef/recipe.rb8
3 files changed, 8 insertions, 10 deletions
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/node.rb b/lib/chef/node.rb
index 83ec7e2550..b04e607624 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -376,12 +376,12 @@ class Chef
normal[:tags]
end
- def tag(*tags)
- tags.each do |tag|
- self.normal[:tags].push(tag.to_s) unless self[:tags].include? tag.to_s
+ def tag(*args)
+ args.each do |tag|
+ tags.push(tag.to_s) unless tags.include? tag.to_s
end
- self[:tags]
+ tags
end
# Extracts the run list from +attrs+ and applies it. Returns the remaining attributes
diff --git a/lib/chef/recipe.rb b/lib/chef/recipe.rb
index 262560f754..0f9bf2655b 100644
--- a/lib/chef/recipe.rb
+++ b/lib/chef/recipe.rb
@@ -97,10 +97,8 @@ class Chef
# true<TrueClass>:: If all the parameters are present
# false<FalseClass>:: If any of the parameters are missing
def tagged?(*tags)
- return false if run_context.node[:tags].nil?
-
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
@@ -111,10 +109,10 @@ class Chef
# tags<Array>:: A list of tags
#
# === Returns
- # tags<Array>:: The current list of run_context.node[:tags]
+ # tags<Array>:: 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