Giter Site home page Giter Site logo

mysql2_chef_gem's People

Contributors

sinfomicien avatar tas50 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

mysql2_chef_gem's Issues

Option action must be equal to one of: nothing, install, delete! You passed :create

Hello,

Today I was changing a few things on my devbox cookbook when the following error suddenly started to happen with the mysql2_chef_gem cookbook.

Option action must be equal to one of: nothing, install, delete! You passed :create

I've always used it as described in the docs and have never changed it:

mysql2_chef_gem 'default' do
  client_version '5.6'
  action :install
end

Then I decided to create a completely fresh cookbok depending only on mysql2_chef_gem, nothing else. Same error happened when I executed the code above on the default recipe.

I believe it has something to do with dependency compatibility. This cookbook requires mysql >=6.0 and a new version of the mysql cookbook has just been released. Coincidently the error started to happen approximately at the same time berkshelf downloaded the new version of the mysql cookbook, 8.0.0.

Removing my Berksfile.lock and adding depends 'mysql' '~> 7.2' to my metadata.rb fixed the issue, but this is probably something you might wanna check...

Deprecation warning

Today I received the following warning:

Deprecated features used!
  version nil currently does not overwrite the value of version. This will change in Chef 13, and the value will be set to nil instead. Please change your code to explicitly accept nil using "property :version, [MyType, nil]", or stop setting this value to nil. at 1 location:
    - /root/chef-solo/cookbooks-2/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb:17:in `block (2 levels) in <class:Mysql>'

The line being referred to here is this one in provider_mysql2_chef_gem_mysql.rb.

Unable to install mysql-client on ubuntu14.04

Error Log

Chef-client : Chef: 12.13.37

OS : ubuntu 14.04

mysql-client version : 5.5

Resource Declaration:
        ---------------------
        # In /tmp/kitchen/cache/cookbooks/mysql/libraries/mysql_client_installation_package.rb

         18:       package package_name do
         19:         version package_version if package_version
         20:         options package_options if package_options
         21:         action :install
         22:       end
         23:     end

        Compiled Resource:
        ------------------
        # Declared in /tmp/kitchen/cache/cookbooks/mysql/libraries/mysql_client_installation_package.rb:18:in `block in <class:MysqlClientInstallationPackage>'

        apt_package("mysql-client-5.5") do
          package_name "mysql-client-5.5"
          action [:install]
          retries 0
          retry_delay 2
          default_guard_interpreter :default
          declared_type :package
          cookbook_name "install_mysql"
          version "5.5.50-0ubuntu0.14.04.1"
        end

        Platform:
        ---------
        x86_64-linux


             ================================================================================
             Error executing action `create` on resource 'mysql_client_installation_package[default]'
             ================================================================================

             Mixlib::ShellOut::ShellCommandFailed
             ------------------------------------
             apt_package[mysql-client-5.5] (/tmp/kitchen/cache/cookbooks/mysql/libraries/mysql_client_installation_package.rb line 18) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
             ---- Begin output of apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 ----
             STDOUT: Reading package lists...
             Building dependency tree...
             Reading state information...
             STDERR: E: Version '5.5.50-0ubuntu0.14.04.1' for 'mysql-client-5.5' was not found
             ---- End output of apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 ----
             Ran apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 returned 100

             Cookbook Trace:
             ---------------
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
             /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'

             Resource Declaration:
             ---------------------
             # In /tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb

       16:           mysql_client 'default' do
       17:             version new_resource.client_version
       18:             action :create
       19:           end
       20:

             Compiled Resource:
             ------------------
             # Declared in /tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb:16:in `block in <class:Mysql>'

             mysql_client_installation_package("default") do
        action [:create]
        retries 0
        retry_delay 2
        default_guard_interpreter :default
        declared_type :mysql_client
        cookbook_name "install_mysql"
        version "5.5.52-0ubuntu0.14.04.1"
        major_version "5.5"
        package_name "mysql-client-5.5"
        package_version "5.5.50-0ubuntu0.14.04.1"
             end

             Platform:
             ---------
             x86_64-linux


           ================================================================================
           Error executing action `install` on resource 'mysql2_chef_gem[default]'
           ================================================================================

           Mixlib::ShellOut::ShellCommandFailed
           ------------------------------------
           mysql_client_installation_package[default] (/tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: apt_package[mysql-client-5.5] (/tmp/kitchen/cache/cookbooks/mysql/libraries/mysql_client_installation_package.rb line 18) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
           ---- Begin output of apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 ----
           STDOUT: Reading package lists...
           Building dependency tree...
           Reading state information...
           STDERR: E: Version '5.5.50-0ubuntu0.14.04.1' for 'mysql-client-5.5' was not found
           ---- End output of apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 ----
           Ran apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 returned 100

           Cookbook Trace:
           ---------------
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:78:in `run_action'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block (2 levels) in converge'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `each'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:106:in `block in converge'
           /tmp/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:105:in `converge'

           Resource Declaration:
           ---------------------
           # In /tmp/kitchen/cache/cookbooks/install_mysql/recipes/default.rb

            26:   mysql2_chef_gem 'default' do
            27:     client_version '5.5.52-0ubuntu0.14.04.1'
            28:     action :install
            29:   end
            30:

           Compiled Resource:
           ------------------
           # Declared in /tmp/kitchen/cache/cookbooks/install_mysql/recipes/default.rb:26:in `from_file'

           mysql2_chef_gem("default") do
             action [:install]
             retries 0
             retry_delay 2
             default_guard_interpreter :default
             declared_type :mysql2_chef_gem
             cookbook_name "install_mysql"
             recipe_name "default"
             client_version "5.5.52-0ubuntu0.14.04.1"
             gem_version "0.3.17"
           end

           Platform:
           ---------
           x86_64-linux

       Recipe: rundeck::server_install
         * service[rundeck] action nothing (skipped due to action :nothing)

       Running handlers:
       [2016-09-14T15:23:28+00:00] ERROR: Running exception handlers
       Running handlers complete
       [2016-09-14T15:23:28+00:00] ERROR: Exception handlers complete
       Chef Client failed. 5 resources updated in 15 seconds
       [2016-09-14T15:23:28+00:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
       [2016-09-14T15:23:28+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
       [2016-09-14T15:23:28+00:00] ERROR: mysql2_chef_gem[default] (install_mysql::default line 26) had an error: Mixlib::ShellOut::ShellCommandFailed: mysql_client_installation_package[default] (/tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: apt_package[mysql-client-5.5] (/tmp/kitchen/cache/cookbooks/mysql/libraries/mysql_client_installation_package.rb line 18) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
       ---- Begin output of apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 ----
       STDOUT: Reading package lists...
       Building dependency tree...
       Reading state information...
       STDERR: E: Version '5.5.50-0ubuntu0.14.04.1' for 'mysql-client-5.5' was not found
       ---- End output of apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 ----
       Ran apt-get -q -y install mysql-client-5.5=5.5.50-0ubuntu0.14.04.1 returned 100
       [2016-09-14T15:23:28+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: 1 actions failed.
>>>>>>     Converge failed on instance <database-installation-ubuntu-1404>.  Please see .kitchen/logs/database-installation-ubuntu-1404.log for more details
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

Chef::Provider::Mysql2ChefGem no longer defined

With the switch to the new-style LWRPs in #38, the following snippet from the README no longer works:

Providers

Chef selects a default provider based on platform and version, but you can specify one if your platform support it.

mysql2_chef_gem 'default' do
  provider Chef::Provider::Mysql2ChefGem::Mariadb
  action :install
end

Attempting to do this results in:

         ================================================================================
         Recipe Compile Error in /tmp/kitchen/cache/cookbooks/my_policy/recipes/default.rb
         ================================================================================
         
         NameError
         ---------
         uninitialized constant Chef::Provider::Mysql2ChefGem
         
         Cookbook Trace:
         ---------------
           /tmp/kitchen/cache/cookbooks/cub_mariadb/recipes/default.rb:72:in `block in from_file'
           /tmp/kitchen/cache/cookbooks/cub_mariadb/recipes/default.rb:71:in `from_file'
           /tmp/kitchen/cache/cookbooks/cub_lamp/recipes/default.rb:1:in `from_file'
           /tmp/kitchen/cache/cookbooks/my_policy/recipes/default.rb:2:in `from_file'
         
         Relevant File Content:
         ----------------------
         /tmp/kitchen/cache/cookbooks/cub_mariadb/recipes/default.rb:
         
          65:  directory 'mydatadir' do
          66:    path node['mariadb']['mysqld']['datadir']
          67:    mode '0755'
          68:  end
          69:  
          70:  # Required addition in order for the database cookbook to talk to mariadb.
          71:  mysql2_chef_gem 'default' do
          72>>   provider Chef::Provider::Mysql2ChefGem::Mariadb
          73:    action :install
          74:  end
          75:  
          76:  mysql_connection_info = {
          77:    host:     'localhost',
          78:    username: node['mariadb']['server_root_user'],
          79:    password: node['mariadb']['server_root_password'],
          80:  }
          81:  
         
         Platform:
         ---------
         x86_64-linux

no implicit conversion of nil into String

Getting the following warning, any ideas?

 mysql2_chef_gem[default] action install

 ================================================================================
 Error executing action `install` on resource 'mysql2_chef_gem[default]'
 ================================================================================

 TypeError
 ---------
 no implicit conversion of nil into String

 Cookbook Trace:
 ---------------
 /var/chef/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb:17:in `block (2 levels) in <class:Mysql>'
 /var/chef/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb:16:in `block in <class:Mysql>'
 /var/chef/cache/cookbooks/compat_resource/files/lib/chef_compat/monkeypatches/chef/runner.rb:41:in `run_action'

 Resource Declaration:
 ---------------------
 # In /var/chef/cache/cookbooks/myorg-mysql/recipes/default.rb

   9: mysql2_chef_gem "default" do
  10:   action :install
  11: end
  12:

 Compiled Resource:
 ------------------
 # Declared in /var/chef/cache/cookbooks/myorg-mysql/recipes/default.rb:9:in `from_file'

 mysql2_chef_gem("default") do
   action [:install]
   retries 0
   retry_delay 2
   default_guard_interpreter :default
   declared_type :mysql2_chef_gem
   cookbook_name "myorg-mysql"
   recipe_name "default"
 end

 Platform:
 ---------
 x86_64-linux

Chef supermarket release without GitHub update

Looks like the latest version of this cookbook on the supermarket is 2.0.0 (with some major changes that broke our cookbooks, but that's a different discussion), but the corresponding changes have not been pushed to this repository.

cannot load such file -- mysql2

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.

Implicit mysql cookbook version dependency

In my org, for reasons that would take too long to explain (if you're desperately curious, I can explain), we're stuck on an older version of the mysql community cookbook (3.0.x). The mysql_client LWRP was added in the mysql 5.0 cookbook. I am, however, upgrading our dependencies to use the newest database cookbook, which now uses this cookbook as a dep.

The first time I converged a node during testing, I got a NoMethodError as the old mysql we're stuck with has no mysql_client resource. Here's the block in your provider:

# As a resource: can pass version from calling recipe
mysql_client 'default' do
version new_resource.client_version
action :create
end

I can work around this by declaring an empty mysql_client LWRP in my internal mysql cookbook to satisfy the requirement, and that's what I've done so far.

I see three possible solutions:

  1. Just declare an explicit version dependency in your metadata
  2. Remove the mysql_client resource in your provider
  3. Some sort of begin/rescue or mysql cookbook version check to determine whether to apply the resource or the mysql::client recipe.

I'm more than happy to help with an initial implementation and to work with you to make it acceptable if you go for solution 3, but I don't know if you consider the issue that big of a deal. FWIW, I'm not entirely sure that you need the mysql dependency โ€” this cookbook seems like more of a dependency on mysql rather than the other way around, although I may certainly be missing some context here. Beyond that, I'd really appreciate if you don't explicitly declare a version dependency in your metadata, too. Regardless, let me know if I can help!

MySQL Version Not Found

I started getting the following error today:

STDERR: E: Version '5.5.49-0+deb7u1' for 'mysql-client-5.5' was not found
---- End output of apt-get -q -y install mysql-client-5.5=5.5.49-0+deb7u1 ----
Ran apt-get -q -y install mysql-client-5.5=5.5.49-0+deb7u1 returned 100

Having done a bit of googling I'm wondering if it's something similar to this - sous-chefs/mysql#439

I searched the codebase and could only find reference to 5.5 so perhaps this is not an issue with the recipe but instead an issue with debian package manager?

I'm using debian 7.8

Add shorthand provides

Add provides :mysql2_chef_gem_mysql and provides :mysql2_chef_gem_mariadb to the providers so they can be easily defined by an attribute.

superclass mismatch for class Mysql2ChefGem

==> default:   1:  class Chef
==> default:   2:    class Provider
==> default:   3:      # Public: Provider to install `mysql2` gem for Chef
==> default: 
==> default:   4>>     class Mysql2ChefGem < Chef::Provider::LWRPBase
==> default:   5:        use_inline_resources if defined?(use_inline_resources)
==> default:   6:  
==> default:   7:        def whyrun_supported?
==> default: 
==> default:   8:          true
==> default:   9:        end
==> default:  10:  
==> default: 
==> default:  11:        def action_install
==> default: 
==> default:  12:          converge_by "install mysql2 chef_gem and dependencies" do
==> default:  13:            recipe_eval do

Accidental duplication of work

Hi Nicolas!

I just recently updated the mysql-chef_gem cookbook to a 1.0.0 state.

After doing that, I wrote my own version of mysql2-chef_gem, and went to upload it to the supermarket.
It was then that I discovered your cookbook.

Since yours seems to be a fork of the old one, I was wondering if you'd like me to send a giant PR.

https://github.com/someara/mysql2-chef_gem

Its cleaned up a bit.... adding serverspecs and removing the dependency on the mysql cookbook. Instead, it download the connectors tarball from a web server and compiles against that. Feel free to swap that out for MariaDB. =)

Let me know!

-s

gem_package installation issue

I'm attempting to update to the newest mysql cookbook 8.0.2. I was using an older version of mysql2_chef_gem and upgrade to use locally 1.1.0 and getting the same error i did with the older version.

       * gem_package[mysql2] action install

         ================================================================================
         Error executing action `install` on resource 'gem_package[mysql2]'
         ================================================================================

         Mixlib::ShellOut::ShellCommandFailed
         ------------------------------------
         Expected process to exit with [0], but received '1'
         ---- Begin output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
         STDOUT: Building native extensions.  This could take a while...
         STDERR: ERROR:  Error installing mysql2:
            ERROR: Failed to build gem native extension.

      /opt/chef/embedded/bin/ruby -r ./siteconf20160906-4638-1ifzp8p.rb extconf.rb
         checking for ruby/thread.h... yes
         checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
         checking for rb_thread_blocking_region()... yes
         checking for rb_wait_for_single_fd()... yes
         checking for rb_hash_dup()... yes
         checking for rb_intern3()... yes
         -----
         Using mysql_config at /usr/bin/mysql_config
         -----
         checking for mysql.h... no
         checking for mysql/mysql.h... no
         -----
         mysql.h is missing.  please check your installation of mysql and try again.
         -----
         *** extconf.rb failed ***
         Could not create Makefile due to some reason, probably lack of necessary
         libraries and/or headers.  Check the mkmf.log file for more details.  You may
         need configuration options.

         Provided configuration options:
            --with-opt-dir
            --with-opt-include
            --without-opt-include=${opt-dir}/include
            --with-opt-lib
            --without-opt-lib=${opt-dir}/lib
            --with-make-prog
            --without-make-prog
            --srcdir=.
            --curdir
            --ruby=/opt/chef/embedded/bin/ruby
            --with-mysql-dir
            --without-mysql-dir
            --with-mysql-include
            --without-mysql-include=${mysql-dir}/include
            --with-mysql-lib
            --without-mysql-lib=${mysql-dir}/lib
            --with-mysql-config
            --without-mysql-config

         extconf failed, exit code 1

         Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mysql2-0.3.17 for inspection.
         Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.17/gem_make.out
         ---- End output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
         Ran /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" returned 1

         Resource Declaration:
         ---------------------
         # In /tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb

   21:           gem_package 'mysql2' do
   22:             gem_binary RbConfig::CONFIG['bindir'] + '/gem'
   23:             version new_resource.gem_version
   24:             action :install
   25:           end
   26:         end

         Compiled Resource:
         ------------------
         # Declared in /tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb:21:in `block in <class:Mysql>'

         gem_package("mysql2") do
    action [:install]
    retries 0
    retry_delay 2
    default_guard_interpreter :default
    package_name "mysql2"
    version "0.3.17"
    declared_type :gem_package
    cookbook_name "mysql_support"
    gem_binary "/opt/chef/embedded/bin/gem"
         end


       ================================================================================
       Error executing action `install` on resource 'mysql2_chef_gem[default]'
       ================================================================================

       Mixlib::ShellOut::ShellCommandFailed
       ------------------------------------
       gem_package[mysql2] (/tmp/kitchen/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb line 21) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
       ---- Begin output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
       STDOUT: Building native extensions.  This could take a while...
       STDERR: ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

    /opt/chef/embedded/bin/ruby -r ./siteconf20160906-4638-1ifzp8p.rb extconf.rb
       checking for ruby/thread.h... yes
       checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
       checking for rb_thread_blocking_region()... yes
       checking for rb_wait_for_single_fd()... yes
       checking for rb_hash_dup()... yes
       checking for rb_intern3()... yes
       -----
       Using mysql_config at /usr/bin/mysql_config
       -----
       checking for mysql.h... no
       checking for mysql/mysql.h... no
       -----
       mysql.h is missing.  please check your installation of mysql and try again.
       -----
       *** extconf.rb failed ***
       Could not create Makefile due to some reason, probably lack of necessary
       libraries and/or headers.  Check the mkmf.log file for more details.  You may
       need configuration options.

       Provided configuration options:
        --with-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/opt/chef/embedded/bin/ruby
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysql-config
        --without-mysql-config

       extconf failed, exit code 1

       Gem files will remain installed in /opt/chef/embedded/lib/ruby/gems/2.1.0/gems/mysql2-0.3.17 for inspection.
       Results logged to /opt/chef/embedded/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.17/gem_make.out
       ---- End output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
       Ran /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" returned 1

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/mysql_support/recipes/remote_root.rb

         3: mysql2_chef_gem 'default' do
         4:   action :install
         5: end
         6:

       Compiled Resource:
       ------------------
       # Declared in /tmp/kitchen/cache/cookbooks/mysql_support/recipes/remote_root.rb:3:in `from_file'

       mysql2_chef_gem("default") do
         action [:install]
         updated true
         updated_by_last_action true
         retries 0
         retry_delay 2
         default_guard_interpreter :default
         declared_type :mysql2_chef_gem
         cookbook_name "mysql_support"
         recipe_name "remote_root"
         gem_version "0.3.17"
       end

I'm using it with database cookbook to install a user for a remote user. It looks like it is having a compilation issue. The mysql installation is fine

mysql> \s

mysql Ver 14.14 Distrib 5.6.29, for Linux (x86_64) using EditLine wrapper

Connection id: 4
Current database:
Current user: root@localhost
SSL: Not in use
Current pager: stdout
Using outfile: ''
Using delimiter: ;
Server version: 5.6.29 MySQL Community Server (GPL)
Protocol version: 10
Connection: Localhost via UNIX socket
Server characterset: latin1
Db characterset: latin1
Client characterset: utf8
Conn. characterset: utf8
UNIX socket: /mysql_tmp/mysqld.sock
Uptime: 8 min 50 sec

Threads: 1 Questions: 41 Slow queries: 0 Opens: 87 Flush tables: 1 Open tables: 80 Queries per second avg: 0.077

Getting "wrong number of arguments (2 for 0)" when installing.

Hi all,
I am trying to create a mysql database in my recipe. But when I tried to create the database, I got the following error.

"cannot load such file -- mysql2"

I think I found the fix for it at http://lists.opscode.com/sympa/arc/chef/2015-02/msg00244.html.

But when I added the following code to my recipe and error pops out.

mysql2_chef_gem 'default' do
action :install
end

Error executing action `install` on resource 'mysql2_chef_gem[default]'
================================================================================

ArgumentError
-------------
wrong number of arguments (2 for 0)

Resource Declaration:
---------------------
# In /var/root/chef-mb/cookbooks/wso2_mb_mysql_database/recipes/default.rb

 14: mysql2_chef_gem 'default' do
 15:   action :install
 16: end
 17:

Compiled Resource:
------------------
# Declared in /var/root/chef-mb/cookbooks/wso2_mb_mysql_database/recipes/default.rb:14:in `from_file'

mysql2_chef_gem("default") do
  action [:install]
  retries 0
  retry_delay 2
  default_guard_interpreter :default
  declared_type :mysql2_chef_gem
  cookbook_name :wso2_mb_mysql_database
  recipe_name "default"
end

I also added "depends 'mysql2_chef_gem', '~> 1.0.1'" in my metadeta file. I am using MAC OS X Yosemite and my ruby version is "ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin14.0]"

Any idea how I can get passed this ?

Will not compile Ruby gems correctly without libmysqlclient-dev

I tried to use this cookbook as a dependency on the WordPress cookbook on Ubuntu 14.04, a clean install, properly apt-get updated and upgraded. The cookbook fails when it is trying to compile Ruby gems related to mysql. (Sorry, I am not a Ruby expert, just a devops admin). The solution was to "apt-get install libmysqlclient-dev". I would add this to the code but I have no idea where to put it and how to specify the dependency on Ubuntu 14.04.

Sometimes necessary to "include" build-essentially separately

I was getting this error:

           * gem_package[mysql2] action install

             ================================================================================
             Error executing action `install` on resource 'gem_package[mysql2]'
             ================================================================================

             Mixlib::ShellOut::ShellCommandFailed
             ------------------------------------
             Expected process to exit with [0], but received '1'
             ---- Begin output of /opt/chef/embedded/bin/gem install mysql2 -q --no-rdoc --no-ri -v "0.3.17" ----
             STDOUT: Building native extensions.  This could take a while...
             STDERR: ERROR:  Error installing mysql2:
                ERROR: Failed to build gem native extension.

So then I added...

include_recipe 'build-essential::default'

right before mysql2_chef_gem and that fixed my problem. I suspect part of the problem is that this cookbook also includes build-essential elsewhere.

Is there a better way of working around this that you know of? Otherwise just be aware (and possibly mention it in the README).

cookbook mysql 8.0.0 compatibility

There is a problem if i try to use cookbooks:

  • mysql 8.0.0
  • mysql2_chef_gem 1.1.0

to install last mysql-server version.

This recipe:

include_recipe 'yum-mysql-community::mysql56'

mysql_service 'default' do
  package_version '5.6.32-2.el7'
  initial_root_password 'mypassword'
  action [:create, :start]
end

mysql2_chef_gem 'default' do
  provider Chef::Provider::Mysql2ChefGem::Mysql
  client_version '5.6.32-2.el7'
  action :install
end

return error:

        ================================================================================
        Error executing action `install` on resource 'yum_package[mysql-community-client]'
        ================================================================================

        Chef::Exceptions::Package
        -------------------------
        Installed package mysql-community-client-5.6.32-2.el7 is newer than candidate package mysql-community-client-5.6.29-2.el7

because mysql2_chef_gem use 'version' attribute in resource mysql_client instead of 'package_version' that should be used in mysql 8.0.0 cookbook.

Problem with Mariadb & Mysql2_chef_gem

Hi,
Apologises if Im asking a stupid queston.

I have been running for years chef cookbooks on Ubuntu
System Ubuntu 16.04,
Cookbooks : database, mariad, mysql2_chef_gem

Im recently since upgrades to Maria 10.2 and usual OS changes, my chef system has started to fail.
I removed the pre-complied gems, but this didnt help.

I have also recently upgraded to mysql2_chef_gem 2.0.1.

There is a dependency in 2.0.1 to include mysql ( but Im using Mariadb), and this causes the compilation to fail.. here is an extract..

` - mariadb (1.5.1)

  • unix_bin (0.2.9)
  • mysql (8.4.0)
  • mysql2_chef_gem (2.0.1)

Installing Cookbook Gems:
Compiling Cookbooks...

================================================================================
Recipe Compile Error in /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_client.rb

NameError

uninitialized constant MysqlCookbook::Helpers

Cookbook Trace:

/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_client.rb:7:in <class:MysqlClient>' /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_client.rb:6:in class:Provider'
/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_client.rb:5:in <class:Chef>' /var/chef/cache/cookbooks/mysql/libraries/provider_mysql_client.rb:4:in <top (required)>'

Relevant File Content:

/var/chef/cache/cookbooks/mysql/libraries/provider_mysql_client.rb:

1: require 'chef/provider/lwrp_base'
2: require_relative 'helpers'
3:
4: class Chef
5: class Provider
6: class MysqlClient < Chef::Provider::LWRPBase
7>> include MysqlCookbook::Helpers
8: provides :mysql_client if defined?(provides)
9:
10: use_inline_resources if defined?(use_inline_resources)
11:
12: def whyrun_supported?
13: true
14: end
15:
16: action :create do

Platform:

x86_64-linux`

I have managed to fix this, by removing the mysql dependency in the mysql2_chef_gem on mysql, so it is not included, but clearly this is a fudge..

Any experience's out there clearly welcome.

BTW : I see that 'database' is now depreciated.. so...what _is then the right way to do a 'mysql_database' to set up a database ? it seems ( with mysql2_chef_gem ) perfer a critical function/helper...
confused of England.
;-)

Deprecated feature to be aware for upcoming Chef 13

Deprecated features used!
  nil is an invalid value for version of resource . 
In Chef 13, this warning will change to an error. Error: Property version must be one of: String!  
You passed nil. at 1 location:
    - /var/chef/cache/cookbooks/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb:17:in `block (2 levels) in <class:Mysql>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.