summaryrefslogtreecommitdiff
path: root/lib/chef/node.rb
diff options
context:
space:
mode:
authorThom May <tmay@expedia.com>2014-03-04 11:18:05 +0000
committerThom May <tmay@expedia.com>2014-03-04 11:18:05 +0000
commit423651d9ca1d20855fac93ca374a0f555bc70a85 (patch)
tree1b260a1b84e24de5b3a0223c6afa916451af220f /lib/chef/node.rb
parentac7fcb41da4bbed8b2d02ae872b40639dfeb53c4 (diff)
parentad6abcc84a0bd9bd47b636f7004588510615c188 (diff)
downloadchef-423651d9ca1d20855fac93ca374a0f555bc70a85.tar.gz
Merge remote-tracking branch 'origin/master' into save-right-run-list
Conflicts: lib/chef/client.rb
Diffstat (limited to 'lib/chef/node.rb')
-rw-r--r--lib/chef/node.rb17
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/chef/node.rb b/lib/chef/node.rb
index 623ca33842..4992ec2430 100644
--- a/lib/chef/node.rb
+++ b/lib/chef/node.rb
@@ -248,6 +248,13 @@ class Chef
run_list.include?(recipe_name) || Array(self[:recipes]).include?(recipe_name)
end
+ # used by include_recipe to add recipes to the expanded run_list to be
+ # saved back to the node and be searchable
+ def loaded_recipe(cookbook, recipe)
+ fully_qualified_recipe = "#{cookbook}::#{recipe}"
+ automatic_attrs[:recipes] << fully_qualified_recipe unless Array(self[:recipes]).include?(fully_qualified_recipe)
+ end
+
# Returns true if this Node expects a given role, false if not.
def role?(role_name)
run_list.include?("role[#{role_name}]")
@@ -309,6 +316,14 @@ 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
+ end
+
+ self[:tags]
+ end
+
# Extracts the run list from +attrs+ and applies it. Returns the remaining attributes
def consume_run_list(attrs)
attrs = attrs ? attrs.dup : {}
@@ -316,7 +331,7 @@ class Chef
if attrs.key?("recipes") || attrs.key?("run_list")
raise Chef::Exceptions::AmbiguousRunlistSpecification, "please set the node's run list using the 'run_list' attribute only."
end
- Chef::Log.info("Setting the run_list to #{new_run_list.inspect} from JSON")
+ Chef::Log.info("Setting the run_list to #{new_run_list.inspect} from CLI options")
run_list(new_run_list)
end
attrs