Skip to content

Instantly share code, notes, and snippets.

@just3ws
Last active December 15, 2015 08:08
Show Gist options
  • Save just3ws/5228097 to your computer and use it in GitHub Desktop.
Save just3ws/5228097 to your computer and use it in GitHub Desktop.
Error when trying to cook the postgresql recipe with Chef.
✘ mhall@G14763 ⮀ ~/projects/chef ⮀ ⭠ master ⮀ knife solo cook three
Checking Chef version...
Starting Chef Client, version 11.4.0
Compiling Cookbooks...
================================================================================
Recipe Compile Error in /tmp/chef-solo/cookbooks/postgresql/recipes/server.rb
================================================================================
NameError
---------
Cannot find a resource for apt_repository on ubuntu version 10.04
Cookbook Trace:
---------------
/tmp/chef-solo/cookbooks/postgresql/recipes/ppa_pitti_postgresql.rb:3:in `from_file'
/tmp/chef-solo/cookbooks/postgresql/recipes/client.rb:23:in `from_file'
/tmp/chef-solo/cookbooks/postgresql/recipes/server.rb:24:in `from_file'
Relevant File Content:
----------------------
/tmp/chef-solo/cookbooks/postgresql/recipes/ppa_pitti_postgresql.rb:
1: include_recipe 'apt'
2:
3>> apt_repository 'pitti-postgresql-ppa' do
4: uri 'http://ppa.launchpad.net/pitti/postgresql/ubuntu'
5: distribution node['lsb']['codename']
6: components %w(main)
7: keyserver 'keyserver.ubuntu.com'
8: key '8683D8A2'
9: action :add
10: end
11:
[2013-03-23T15:23:18+00:00] ERROR: Running exception handlers
[2013-03-23T15:23:18+00:00] ERROR: Exception handlers complete
Chef Client failed. 0 resources updated
[2013-03-23T15:23:18+00:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out
[2013-03-23T15:23:18+00:00] FATAL: NameError: Cannot find a resource for apt_repository on ubuntu version 10.04
ERROR: RuntimeError: chef-solo failed. See output above.
# added the line `depends "apt"` to the postgresql recipe's metadata.rb.
# It did something and seems to have gotten past the apt problem... to a whole new problem. :,(
# Will look into it further later when I have time. :P
✘ mhall@g14763 ⮀ ~/projects/chef ⮀ ⭠ master± ⮀ knife solo cook three --no-librarian
Checking Chef version...
Starting Chef Client, version 11.4.0
Compiling Cookbooks...
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/provider/lwrp_base.rb:97: warning: already initialized constant AptPreference
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/provider/lwrp_base.rb:97: warning: already initialized constant AptRepository
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/resource/lwrp_base.rb:51: warning: already initialized constant AptPreference
/opt/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-11.4.0/lib/chef/resource/lwrp_base.rb:51: warning: already initialized constant AptRepository
Converging 17 resources
Recipe: apt::default
* execute[apt-get-update] action run (skipped due to not_if)
* execute[apt-get update] action nothing (up to date)
* execute[apt-get autoremove] action nothing (up to date)
* execute[apt-get autoclean] action nothing (up to date)
* package[update-notifier-common] action install (up to date)
* execute[apt-get-update-periodic] action run (skipped due to only_if)
* directory[/var/cache/local] action create (up to date)
* directory[/var/cache/local/preseeding] action create (up to date)
Recipe: main::default
* user[deployer] action create (up to date)
Recipe: postgresql::ppa_pitti_postgresql
* apt_repository[pitti-postgresql-ppa] action addRecipe: <Dynamically Defined Resource>
* execute[install-key 8683D8A2] action run (skipped due to not_if)
* file[/var/lib/apt/periodic/update-success-stamp] action nothing (up to date)
* execute[apt-get update] action nothing (up to date)
* file[/etc/apt/sources.list.d/pitti-postgresql-ppa.list] action create (up to date)
- would evaluate block and run any associated actions
Recipe: postgresql::client
* package[postgresql-client] action install (up to date)
* package[libpq-dev] action install (up to date)
Recipe: postgresql::server_debian
* package[postgresql] action install (up to date)
* service[postgresql] action enable
================================================================================
Error executing action `enable` on resource 'service[postgresql]'
================================================================================
Chef::Exceptions::Exec
----------------------
/usr/sbin/update-rc.d postgresql-9.2 defaults returned 1, expected 0
Resource Declaration:
---------------------
# In /tmp/chef-solo/cookbooks/postgresql/recipes/server_debian.rb
30: service "postgresql" do
31: service_name node['postgresql']['server']['service_name']
32: supports :restart => true, :status => true, :reload => true
33: action [:enable, :start]
34: end
Compiled Resource:
------------------
# Declared in /tmp/chef-solo/cookbooks/postgresql/recipes/server_debian.rb:30:in `from_file'
service("postgresql") do
action [:enable, :start]
supports {:restart=>true, :status=>true, :reload=>true}
retries 0
retry_delay 2
service_name "postgresql-9.2"
pattern "postgresql"
startup_type :automatic
cookbook_name :postgresql
recipe_name "server_debian"
end
[2013-03-23T20:25:43+00:00] ERROR: Running exception handlers
[2013-03-23T20:25:43+00:00] ERROR: Exception handlers complete
Chef Client failed. 1 resources updated
[2013-03-23T20:25:43+00:00] FATAL: Stacktrace dumped to /tmp/chef-solo/chef-stacktrace.out
[2013-03-23T20:25:43+00:00] FATAL: Chef::Exceptions::Exec: service[postgresql] (postgresql::server_debian line 30) had an error: Chef::Exceptions::Exec: /usr/sbin/update-rc.d postgresql-9.2 defaults returned 1, expected 0
ERROR: RuntimeError: chef-solo failed. See output above.
@developish
Copy link

Have you had progress on the second problem? I'm currently dealing with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment