attribute value availability + the implicit dependency graph and chef-deploy patch


Chronological Thread 
  • From: Ian Kallen <spidaman.list@gmail.com>
  • To: chef@lists.opscode.com
  • Subject: attribute value availability + the implicit dependency graph and chef-deploy patch
  • Date: Thu, 23 Apr 2009 09:31:01 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type; b=x2U4+YXLBuQPxKp9f6HX/S5ZjqdHscmNHNE2q+RRftkfMmVoX4D2ybBKkeF1Ow+0xz +P2SIVctAJCr+Y41hFmkKeIihEObLL/6GctWclDG++/0h1Xa3J+jo7+6NxpShN9h8Wi+ Prxz0EM77d5XRXxcZtvHh6uq4SwpN08Y7dPbQ=

Last night I was seeing an issue where provisioning "apache + passenger worked" but "apache + passenger + rails app" (deploying the rails app w/chef-deploy) was failing. In the first scenario, the passenger cookbook's attributes was able to access the apache cookbook's attributes. In the second scenario, the apache attributes were *not* accessible to passenger's. But in all cases apache attributes are accessible in the passenger recipe script. In the second scenario I launched with { "recipes" : [ "railsapp" ] }, since the rails app recipe has 'include_recipe "passenger"' and the passenger recipe has 'include_recipe "apache"' I expected the dependencies declared via include_recipe to be traversed to make the attribute values available. But apparently that doesn't work, cookbook processing order is random (?!). This was really frustrating to debug (the symptom was template names/paths mysteriously null valued and fairly useless error messages in the ensuing stacktrace); are there docs I've overlooked on how cookbooks relate to each other as far as execution order and data model life cycles? <fujin> mentioned plans for something like a "require_attribute" operator in the conception phase, which sounds great, though it seems like requiring a recipe should be sufficient to carry attribute values forward; there's a dependency graph already implied by the "require_recipe" operator. If there are docs I've overlooked, forgive the length and thanks for reading this far :)

Finally, the chef-deploy resource seemed to be puking on some path disagreements as well as null valued config elements, diff attached.
thanks!
-Ian

--
Ian Kallen
blog: http://www.arachna.com/roller/spidaman
tweetz: http://twitter.com/spidaman
vox: 415.505.5208

--- a/lib/chef-deploy/cached_deploy.rb
+++ b/lib/chef-deploy/cached_deploy.rb
@@ -24,7 +24,9 @@ class CachedDeploy
   end
   
   def restart
-    unless @configuration[:restart_command].empty?
+    #unless @configuration[:restart_command].empty?
+    # undefined method `empty?' for nil:NilClass
+    if @configuration.has_key? :restart_command && 
@configuration[:restart_command]
       Chef::Log.info "restarting app: #{latest_release}"
       Chef::Log.info run(@configuration[:restart_command])
     end
@@ -63,7 +65,7 @@ class CachedDeploy
   
   def migrate
     if @configuration[:migrate]
-      run "ln -nfs #{shared_path}/config/database.yml 
#{latest_release}/config/
+      run "ln -nfs #{shared_path}/cached-copy/config/database.yml 
#{latest_rele
       Chef::Log.info "Migrating: cd #{latest_release} && 
RAILS_ENV=#{@configura
       Chef::Log.info run("cd #{latest_release} && 
RAILS_ENV=#{@configuration[:e
     end
@@ -175,4 +177,4 @@ class CachedDeploy
     def copy_exclude
       @copy_exclude ||= Array(configuration.fetch(:copy_exclude, []))
     end
-end
\ No newline at end of file
+end


Archive powered by MHonArc 2.6.16.

§