Skip to content

Instantly share code, notes, and snippets.

@cmaxw
Last active December 26, 2015 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cmaxw/7148340 to your computer and use it in GitHub Desktop.
Save cmaxw/7148340 to your computer and use it in GitHub Desktop.
Trying to create a database from a recipe
opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:193:in `fork'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:193:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application.rb:183:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application/client.rb:302:in `block in run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application/client.rb:294:in `loop'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application/client.rb:294:in `run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application.rb:66:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:23:in `load'
/usr/bin/chef-client:23:in `<main>'^C
root@calagator:~# cat /var/chef/cache/chef-stacktrace.out
Generated at 2013-10-24 15:28:12 +0000
NoMethodError: undefined method `application' for Chef::Resource::PostgresqlDatabase
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/resource.rb:294:in `method_missing'
/var/chef/cache/cookbooks/application/resources/default.rb:130:in `method_missing'
/var/chef/cache/cookbooks/calagator/recipes/default.rb:20:in `block in from_file'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/dsl/recipe.rb:71:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/dsl/recipe.rb:71:in `method_missing'
/var/chef/cache/cookbooks/calagator/recipes/default.rb:11:in `from_file'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/mixin/from_file.rb:30:in `instance_eval'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/mixin/from_file.rb:30:in `from_file'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/cookbook_version.rb:237:in `load_recipe'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/run_context.rb:151:in `load_recipe'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/run_context/cookbook_compiler.rb:139:in `block in compile_recipes'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/run_context/cookbook_compiler.rb:137:in `each'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/run_context/cookbook_compiler.rb:137:in `compile_recipes'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/run_context/cookbook_compiler.rb:74:in `compile'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/run_context.rb:86:in `load'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:249:in `setup_run_context'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:492:in `do_run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:199:in `block in run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:193:in `fork'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/client.rb:193:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application.rb:183:in `run_chef_client'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application/client.rb:302:in `block in run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application/client.rb:294:in `loop'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application/client.rb:294:in `run_application'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/lib/chef/application.rb:66:in `run'
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.6.2/bin/chef-client:26:in `<top (required)>'
/usr/bin/chef-client:23:in `load'
/usr/bin/chef-client:23:in `<main>'
#
# Cookbook Name:: calagator
# Recipe:: default
#
# Copyright 2013, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
include_recipe "database::postgresql"
application "calagator" do
path "/var/www/calagator"
owner "deploy"
group "deploy"
repository "https://github.com/cmaxw/calagator.git"
rails do
bundler true
end
passenger_apache2
postgresql_database 'calagator' do
connection(
:host => '127.0.0.1',
:port => 5432,
:username => 'postgres',
:password => node['postgresql']['password']['postgres']
)
action :create
end
end
[2013-10-24T15:28:12+00:00] WARN: Installation of pg gem successful!
================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/calagator/recipes/default.rb
================================================================================
NoMethodError
-------------
undefined method `application' for Chef::Resource::PostgresqlDatabase
Cookbook Trace:
---------------
/var/chef/cache/cookbooks/application/resources/default.rb:130:in `method_missing'
/var/chef/cache/cookbooks/calagator/recipes/default.rb:20:in `block in from_file'
/var/chef/cache/cookbooks/calagator/recipes/default.rb:11:in `from_file'
Relevant File Content:
----------------------
/var/chef/cache/cookbooks/application/resources/default.rb:
123: end
124: end
125: end
126: raise NameError, "No resource found for #{name}. Tried #{lookup_path.join(', ')}" unless resource
127: # Enforce action :nothing in case people forget
128: resource.action :nothing
129: # Make this a weakref to prevent a cycle between the application resource and the sub resources
130>> resource.application WeakRef.new(self)
131: resource.type name
132: @sub_resources << resource
133: resource
134: end
135:
136: def do_i_respond_to?(*args)
137: name = args.first.to_s
138: # Build the set of names to check for a valid resource
139: lookup_path = ["application_#{name}"]
[2013-10-24T15:28:12+00:00] ERROR: Running exception handlers
[2013-10-24T15:28:12+00:00] ERROR: Exception handlers complete
[2013-10-24T15:28:12+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 5 resources updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment