SUSE-Cloud / soksolok

SUSE OpenStack knife-solo kitchen
1 stars 5 forks source link

The postgresql cookbook has trouble installing the pg ruby gem #7

Open iartarisi opened 11 years ago

iartarisi commented 11 years ago
Relevant File Content:
----------------------
/tmp/chef-solo/cookbooks/postgresql/recipes/ruby.rb:

 54:  
 55:    end
 56:  
 57:    begin
 58:      chef_gem "pg"
 59:    rescue Gem::Installer::ExtensionBuildError => e
 60:      # Are we an omnibus install?
 61>>     raise if RbConfig.ruby.scan(%r{(chef|opscode)}).empty?
 62:      # Still here, must be omnibus. Lets make this thing install!
 63:      Chef::Log.warn 'Failed to properly build pg gem. Forcing properly linki
ng and retrying (omnibus fix)'                                                  
 64:      gem_dir = e.message.scan(%r{will remain installed in ([^ ]+)}).flatten.
first                                                                           
 65:      raise unless gem_dir
 66:      gem_name = File.basename(gem_dir)
 67:      ext_dir = File.join(gem_dir, 'ext')
 68:      gem_exec = File.join(File.dirname(RbConfig.ruby), 'gem')
 69:      new_content = <<-EOS
 70:  require 'rbconfig'

Installing the rubygem-pg package manually seems to solve this issue.

mvidner commented 10 years ago

It passes the second time around. Immediately before chef_gem "pg", The package rubygem-pg.rpm is installed. It seems that chef_gem does not pick it up.

mvidner commented 10 years ago

But the second run actually continues with:

Recipe: postgresql::ruby
  * chef_gem[pg] action install (up to date)
Recipe: openstack-ops-database::openstack-db
  * database[create nova database] action create
================================================================================
Error executing action `create` on resource 'database[create nova database]'
================================================================================

LoadError
---------
cannot load such file -- pg_ext

and rpm -V rubygem-pg shows the package is indeed missing pg_ext.so. It is an artifact of the failed chef_gem attempt. zypper install --force rubygem-pg solves it.