sinfomicien / mysql2_chef_gem

Apache License 2.0
12 stars 38 forks source link

cannot load such file -- mysql2 #47

Open heaven opened 6 years ago

heaven commented 6 years ago

The error is happening while using the deprecated database cookbook:

Recipe: wego_teamcity::mysql
  * mysql2_chef_gem[default] action install
    * mysql_client_installation_package[default] action create
      * apt_package[mysql-client-5.5, libmysqlclient-dev] action install (up to date)
       (up to date)
    * gem_package[mysql2] action install (up to date)
     (up to date)
  * mysql_database[teamcity] action create

    ================================================================================
    Error executing action `create` on resource 'mysql_database[teamcity]'
    ================================================================================

    LoadError
    ---------
    cannot load such file -- mysql2

    Cookbook Trace:
    ---------------
    /var/chef/cache/cookbooks/database/libraries/provider_database_mysql.rb:103:in `test_client'
    /var/chef/cache/cookbooks/database/libraries/provider_database_mysql.rb:37:in `block in <class:Mysql>'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
    /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'

Also using the RVM cookbook with gem_package option enabled.

hauntingEcho commented 6 years ago

depricated database cookbook

I'd recommend migrating away from that, since it's depricated (and thus not maintained anymore). In the meantime, have you tried the solution here?

heaven commented 6 years ago

Migrate to what? :) I think the problem is that there are no alternatives.

This bug was related to the rvm cookbook, which makes chef_gem work like gem_package, so all gems installed with any of these resources installed to rvm's directory and Chef doesn't see them any longer.