summaryrefslogtreecommitdiff
path: root/lib/chef/client.rb
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2008-10-02 14:41:13 -0700
committerAdam Jacob <adam@hjksolutions.com>2008-10-02 14:41:13 -0700
commit28a6ace0566b93a538effa9ddb61e1bc20031534 (patch)
treeabb00321038f9e84beee4de355777a4f429ff71c /lib/chef/client.rb
parentcdd43e77db271c2accda73f94efa59358b900dfe (diff)
parent77641960368293d4e33bfa4bf8ce1f594b7f72eb (diff)
downloadchef-28a6ace0566b93a538effa9ddb61e1bc20031534.tar.gz
merging in fujins service resource and provider
Diffstat (limited to 'lib/chef/client.rb')
-rw-r--r--lib/chef/client.rb32
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index c8ab31eed7..f6ee8c14c4 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -59,7 +59,9 @@ class Chef
sync_definitions
sync_recipes
do_attribute_files
+ # do_recipe_files
save_node
+ # compile
converge
save_node
true
@@ -70,6 +72,9 @@ class Chef
#
# === Parameters
# node_name<String>:: The name of the node to build - defaults to nil
+ #
+ # === Returns
+ # node:: Returns the created node object, also stored in @node
def build_node(node_name=nil)
node_name ||= Facter["fqdn"].value ? Facter["fqdn"].value : Facter["hostname"].value
@safe_name = node_name.gsub(/\./, '_')
@@ -94,6 +99,9 @@ class Chef
# data.
#
# If it has not, we register it by calling create_registration.
+ #
+ # === Returns
+ # true:: Always returns true
def register
@registration = nil
begin
@@ -110,17 +118,25 @@ class Chef
else
create_registration
end
+ true
end
# Generates a random secret, stores it in the Chef::Filestore with the "registration" key,
# and posts our nodes registration information to the server.
+ #
+ # === Returns
+ # true:: Always returns true
def create_registration
@secret = random_password(500)
Chef::FileStore.store("registration", @safe_name, { "secret" => @secret })
@rest.post_rest("registrations", { :id => @safe_name, :password => @secret })
+ true
end
# Authenticates the node via OpenID.
+ #
+ # === Returns
+ # true:: Always returns true
def authenticate
response = @rest.post_rest('openid/consumer/start', {
"openid_identifier" => "#{Chef::Config[:openid_url]}/openid/server/node/#{@safe_name}",
@@ -193,6 +209,9 @@ class Chef
# Gets all the attribute files included in all the cookbooks available on the server,
# and executes them.
+ #
+ # === Returns
+ # true:: Always returns true
def do_attribute_files
update_file_cache("attributes", @rest.get_rest('cookbooks/_attribute_files'))
Chef::FileCache.list.each do |cache_file|
@@ -213,12 +232,19 @@ class Chef
end
# Updates the current node configuration on the server.
+ #
+ # === Returns
+ # true:: Always returns true
def save_node
@node = @rest.put_rest("nodes/#{@safe_name}", @node)
+ true
end
- # Compiles the full list of recipes for the node from the local cache, and
- # passes it to an instance of Chef::Runner.converge.
+ # Compiles the full list of recipes for the server, and passes it to an instance of
+ # Chef::Runner.converge.
+ #
+ # === Returns
+ # true:: Always returns true
def converge
Chef::Config[:cookbook_path] = File.join(Chef::Config[:file_cache_path], "cookbooks")
compile = Chef::Compile.new()
@@ -241,4 +267,4 @@ class Chef
end
end
-end \ No newline at end of file
+end