Class Chef::Node
In: lib/chef/node.rb
lib/chef/node/attribute.rb
Parent: Object

Methods

Included Modules

Chef::Mixin::CheckHelper Chef::Mixin::FromFile Chef::Mixin::ParamsValidate Chef::Mixin::LanguageIncludeAttribute Chef::IndexQueue::Indexable

Classes and Modules

Class Chef::Node::Attribute

Constants

DESIGN_DOCUMENT = { "version" => 11, "language" => "javascript", "views" => { "all" => { "map" => <<-EOJS function(doc) { if (doc.chef_type == "node") { emit(doc.name, doc); } } EOJS

Attributes

automatic_attrs  [RW] 
cookbook_collection  [RW]  TODO: 5/18/2010 cw/timh. cookbook_collection should be removed from here and for any place it‘s needed, it should be accessed through a Chef::RunContext
couchdb  [RW] 
couchdb_id  [R] 
couchdb_rev  [RW] 
default_attrs  [RW] 
normal_attrs  [RW] 
override_attrs  [RW] 
recipe_list  [RW] 
run_list  [RW] 
run_state  [RW] 

Public Class methods

List all the Chef::Node objects in the CouchDB. If inflate is set to true, you will get the full list of all Nodes, fully inflated.

Create a Chef::Node from JSON

Public Instance methods

Return an attribute of this node. Returns nil if the attribute is not found.

Apply the default and overrides attributes from the expansion passed in, which came from roles.

Used by the DSL

Return true if this Node has a given attribute, false if not. Takes either a symbol or a string.

Only works on the top level. Preferred way is to use the normal [] style lookup and call attribute?()

Remove this node from the CouchDB

Save this node to the CouchDB

Consumes the combined run_list and other attributes in attrs

Consume data from ohai and Attributes provided as JSON on the command line.

Extracts the run list from attrs and applies it. Returns the remaining attributes

Create the node via the REST API

Set a default of this node, but auto-vivifiy any Mashes that might be missing

Set a default attribute of this node, auto-vivifiying any mashes that are missing, but if the final value already exists, don‘t set it

Remove this node via the REST API

Yield each key of the top level to the block.

Iterates over each attribute, passing the attribute and value to the block.

Expands the node‘s run list and sets the default and override attributes. Also applies stored attributes (from json provided on the command line)

Returns the fully-expanded list of recipes, a RunListExpansion.

Find a recipe for this Chef::Node by fqdn. Will search first for Chef::Config["node_path"]/fqdn.rb, then hostname.rb, then default.rb.

Returns a new Chef::Node object.

Raises an ArgumentError if it cannot find the node.

Used by DSL. Loads the attribute file specified by the short name of the file, e.g., loads specified cookbook‘s

  "attributes/mailservers.rb"

if passed

  "mailservers"

Load all attribute files for all cookbooks associated with this node.

Encouraged to only get used for lookups - while you can do sets from here, it‘s not as explicit as using the normal/default/override interface.

Set the name of this Node, or return the current name.

Used by DSL

Set a normal attribute of this node, but auto-vivifiy any Mashes that might be missing

Set a normal attribute of this node, auto-vivifiying any mashes that are missing, but if the final value already exists, don‘t set it

Set an override attribute of this node, but auto-vivifiy any Mashes that might be missing

Set an override attribute of this node, auto-vivifiying any mashes that are missing, but if the final value already exists, don‘t set it

Returns true if this Node expects a given recipe, false if not.

First, the run list is consulted to see whether the recipe is explicitly included. If it‘s not there, it looks in run_state[:seen_recipes], which is populated by include_recipe statements in the DSL (and thus would not be in the run list).

NOTE: It‘s used by cookbook authors

Clear defaults and overrides, so that any deleted attributes between runs are still gone.

Returns true if this Node expects a given role, false if not.

Returns an Array of roles and recipes, in the order they will be applied. If you call it with arguments, they will become the new list of roles and recipes.

Returns true if this Node expects a given role, false if not.

Save this node via the REST API

set()

Alias for normal

set_unless()

Alias for normal_unless

Lazy initializer for tags attribute

Transform the node to a Hash

Serialize this object as a hash

[Validate]