[chef] Re: Re: Re: Re: Re: application_python!?!?!


Chronological Thread 
  • From: "John E. Vincent (lusis)" < >
  • To: " " < >
  • Subject: [chef] Re: Re: Re: Re: Re: application_python!?!?!
  • Date: Tue, 27 Aug 2013 14:14:49 -0400

Honestly, while that plugin is hella cool you are MUCH better off making a decision one way or the other if a cookbook will or will not support solo. The changes needed for that are so minimal that I can see no real need to require something external that would have to track upstream changes in the chef search API.

The logic needed to make a search-based recipe support solo can be boiled down to:
- Add attribute support for static definition of anything that would normally come back from a search result
- Add a conditional logic to use static attributes instead of search results
- Additionally, you can also favor static definitions of attributes over search results either by default (use static first and fallback to search if available) or as an attribute flag (node['foobar']['use_static'] = true)

I tend to prefer the second approach in the last bullet as I don't want an accidental attribute overriding search results.

Regardless, as a side effect you get a much more community friendly cookbook and one that is more testable.


On Tue, Aug 27, 2013 at 1:41 PM, Justin Alexander < " target="_blank"> > wrote:
THANKS!!! 

also I found this: https://github.com/edelight/chef-solo-search


On Tue, Aug 27, 2013 at 8:22 PM, Noah Kantrowitz < " target="_blank"> > wrote:
Yes, both the database config in the django block and the nginx config accept a manual override (#host in the database, #hosts in the nginx) which if present will make it not fall back to search().

--Noah

On Aug 27, 2013, at 10:06 AM, Justin Alexander wrote:

> Thankyou so much!!!!!!!!!
>
> I was able to locate and comment out the search code.  Is there a configuration based way to do this that would be less hacky?
>
>
>
> On Tue, Aug 27, 2013 at 7:42 PM, Noah Kantrowitz < " target="_blank"> > wrote:
> The example as written is not compatible with chef-solo because it uses the search API. You can modify to hard-code the hostnames for the database server and application servers (presumably in your case both are just ['localhost']).
>
> --Noah
>
> On Aug 27, 2013, at 8:28 AM, Justin Alexander wrote:
>
> > I keep getting the same error, no matter what I do. I am still a Chef-Noob.  Can anyone give me a clue?
> >
> >
> > Inside of a Vagrant image, I am trying to make a working test of the demo at:
> > https://github.com/opscode-cookbooks/application_python
> >
> >
> > It runs until I get the error:
> >
> > [2013-08-27T14:41:21+00:00] INFO: Processing application_python_django[packaginator] action before_deploy (bluevine::default line 115)
> > [2013-08-27T14:41:21+00:00] WARN: Failed to read the private key /etc/chef/client.pem: #<Errno::ENOENT: No such file or directory - /etc/chef/client.pem>
> >
> > ================================================================================
> > Error executing action `before_deploy` on resource 'application_python_django[packaginator]'
> > ================================================================================
> >
> > Chef::Exceptions::PrivateKeyMissing
> > -----------------------------------
> > I cannot read /etc/chef/client.pem, which you told me to use to sign requests!
> >
> > Cookbook Trace:
> > ---------------
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/libraries/default.rb:102:in `find_matching_role'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/libraries/default.rb:120:in `find_database_server'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application_python/providers/django.rb:131:in `created_settings_file'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application_python/providers/django.rb:40:in `class_from_file'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:110:in `before_deploy'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:109:in `each'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:109:in `before_deploy'
> >
> > Resource Declaration:
> >
> > ---------------------
> > # In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/resources/default.rb
> >
> > 114:       Chef::Log.debug "Trying to load application resource #{resource_name} for #{name}"
> > 115:       resource = super(resource_name.to_sym, self.name, &block)
> > 116:       break
> >
> > Compiled Resource:
> > ------------------
> > # Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/resources/default.rb:115:in `method_missing'
> >
> > application_python_django("packaginator") do
> >   retry_delay 2
> >   type :django
> >   database {"engine"=>"postgresql_psycopg2", "password"=>"awesome_password", "username"=>"packaginator", "database"=>"packaginator"}
> >   settings_template "settings.py.erb"
> >   local_settings_file "local_settings.py"
> >   packages ["redis"]
> >   retries 0
> >   recipe_name "default"
> >   symlink_before_migrate {"local_settings.py"=>"local_settings.py"}
> >   migration_command "/srv/packaginator/shared/env/bin/python manage.py syncdb --noinput"
> >   database_master_role "packaginator_database_master"
> >   debug true
> >   action [:nothing]
> >   cookbook_name :bluevine
> >   requirements "requirements/mkii.txt"
> >   collectstatic "build_static --noinput"
> > end
> >
> >
> > ================================================================================
> > Error executing action `create` on resource 'ruby_block[packaginator before_deploy]'
> > ================================================================================
> >
> > Chef::Exceptions::PrivateKeyMissing
> > -----------------------------------
> > application_python_django[packaginator] (bluevine::default line 115) had an error: Chef::Exceptions::PrivateKeyMissing: I cannot read /etc/chef/client.pem, which you told me to use to sign requests!
> >
> > Cookbook Trace:
> > ---------------
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/libraries/default.rb:102:in `find_matching_role'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/libraries/default.rb:120:in `find_database_server'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application_python/providers/django.rb:131:in `created_settings_file'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application_python/providers/django.rb:40:in `class_from_file'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:110:in `before_deploy'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:109:in `each'
> > /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:109:in `before_deploy'
> >
> > Resource Declaration:
> > ---------------------
> > # In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb
> >
> > 106:
> > 107:   ruby_block "#{new_resource.name} before_deploy" do
> > 108:     block do
> > 109:       new_resource.sub_resources.each do |resource|
> > 110:         resource.run_action :before_deploy
> > 111:       end
> > 112:       callback(:before_deploy, new_resource.before_deploy)
> > 113:     end
> > 114:   end
> > 115: end
> >
> > Compiled Resource:
> > ------------------
> > # Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:107:in `before_deploy'
> >
> > ruby_block("packaginator before_deploy") do
> >   retry_delay 2
> >   retries 0
> >   action "create"
> >   cookbook_name :bluevine
> >   block #<Proc:0x00007f80a05da4a8@/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb:108>
> > end
> >
> > [2013-08-27T14:41:21+00:00] ERROR: Running exception handlers
> > [2013-08-27T14:41:21+00:00] ERROR: Exception handlers complete
> > [2013-08-27T14:41:21+00:00] FATAL: Stacktrace dumped to /tmp/vagrant-chef-1/chef-stacktrace.out
> > [2013-08-27T14:41:21+00:00] FATAL: Chef::Exceptions::PrivateKeyMissing: ruby_block[packaginator before_deploy] (/tmp/vagrant-chef-1/chef-solo-1/cookbooks/application/providers/default.rb line 107) had an error: Chef::Exceptions::PrivateKeyMissing: application_python_django[packaginator] (bluevine::default line 115) had an error: Chef::Exceptions::PrivateKeyMissing: I cannot read /etc/chef/client.pem, which you told me to use to sign requests!
> > Chef never successfully completed! Any errors should be visible in the
> > output above. Please fix your recipes so that they properly complete.
> >
>
>






Archive powered by MHonArc 2.6.16.

§