[Question]
$bundle exec knife solo cookie node name
The following error occurs in
Error executing action create
on resource 'mysql_database [aws]'
*Currently, recipes that do not use database are working
[What I want to do]
I want to write recipe using opscode database
(The following recipe is just trying to create a database.)
*Official
https://github.com/opscode-cookbooks/database/blob/master/README.md
[Recipe]
source "https://api.berkshelf.com"
cookbook "mysql2_chef_gem"
cookbook "database"
Cookbook "yum"
{
"run_list": [
"recipe [sample]"
],
"automatic": {
"ipaddress": "node name"
}
}
name 'sample'
maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installations/Configures mysql'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')))
version '0.1.0'
depend 'database'
mysql_connection_info={
: host=>'127.0.0.1',
—username=>'root',
—password=>'password'
}
mysql_database "aws" do
connection mysql_connection_info
action:create
end
[Environment]
Mac OSX 10.9.5
Chef Development Kit Version: 0.4.0
Chef: 12.0.3
Bundler version 1.7.11
database(4.0.2)
The tip of the check is Amazon Linux (20149)
】Other br
If you have any information that might give you a hint on overseas websites,
Please point it out.
[Error]
mysql_database[aws] action create================================================================================
Error executing action create
on resource 'mysql_database [aws]' ================================================================================
cannot load soch file --mysql2
/home/ec2-user/chef-solo/cookbooks-2/database/libraries/provider_database_mysql.rb:103:in test_client'
block in'
/home/ec2-user/chef-solo/cookbooks-2/database/libraries/provider_database_mysql.rb:37:in
15: mysql_database "aws" do
16:connection mysql_connection_info
17:action:create
18:end
19:
mysql_database("aws")do
providerChef::Provider::Database::Mysql
action[:create]
retries0
retry_delay2
guard_interpreter:default
database_name "aws"
cookbook_name:sample
recipe_name "default"
connection {:host=>"127.0.0.1",:username=>"root",:password=>"password"}
end
Running handlers:
[2015-02-15T08:20:08+00:00] ERROR:Running exception handlers
Running handlers complete
[2015-02-15T08:20:08+00:00] ERROR: Exception handlers complete
[2015-02-15T08:20:08+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed.0 resources updated in 1.391575845 seconds
[2015-02-15T08:20:08+00:00] ERROR: mysql_database [aws] (sample::default line 15) had an error: LoadError: cannot load Such file --mysql2
[2015-02-15T08:20:08+00:00] FATAL:Chef::Exceptions::ChildConvergeError:Chef run process expired successfully (exit code1)
[Additional]
source "https://api.berkshelf.com"
cookbook "mysql2_chef_gem"
cookbook "database"
Cookbook "yum"
name 'sample'
maintainer 'YOUR_COMPANY_NAME'
maintainer_email 'YOUR_EMAIL'
license 'All rights reserved'
description 'Installations/Configures mysql'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')))
version '0.1.0'
depend 'mysql2_chef_gem'
depend 'database'
default ['mysql'] ['version'] = '5.5'
#
# Cookbook Name::mysql
# recipe::default
#
# Copyright 2014, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
mysql2_chef_gem'default'do
client_version node ['mysql'] ['version'] if node ['mysql']
action:install
end
mysql_connection_info={
: host=>'127.0.0.1',
—username=>'root',
—password=>'password'
}
mysql_database "aws" do
connection mysql_connection_info
action:create
end
Server version: 5.5.40 MySQL Community Server (GPL)
[Error]
Running Chef onaws_controller...
Checking Chef version...
Installing Berkshelf cookies to 'cookbooks'...
Resolving cookbook dependencies...
Using apt(2.6.1)
Using build-essential (2.1.3)
Using chef-sugar (2.5.0)
Using database (4.0.2)
Using mariadb (0.2.12)
Using mysql(6.0.13)
Using mysql2_chef_gem(1.0.1)
Using openssl (2.0.2)
Using postgresql(3.4.14)
Using rbac(1.0.2)
Using resource-control (0.1.1)
Using smf(2.2.1)
Using yum(3.5.2)
Using yum-epel (0.6.0)
Using yum-mysql-community (0.1.12)
Vendoring apt (2.6.1) to Path/cookbooks/apt
Vending build-essential (2.1.3) to path/cookbooks/build-essential
Vending chef-sugar (2.5.0) to path/cookbooks/chef-sugar
Vending database (4.0.2) to path/cookbooks/database
Vendoring mariadb (0.2.12) to Path/cookbooks/mariadb
Vendoring mysql (6.0.13) to Path/cookbooks/mysql
Vendoring mysql2_chef_gem (1.0.1) to Path/cookbooks/mysql2_chef_gem
Vending openssl (2.0.2) to path/cookbooks/opensl
Vending postgresql (3.4.14) to path/cookbooks/postgresql
Vendoring rbac (1.0.2) to Path/cookbooks/rbac
Vending resource-control (0.1.1) to path/cookbooks/resource-control
Vendoring smf (2.2.1) to Path/cookbooks/smf
Vendoring yum (3.5.2) to Path/cookbooks/yum
Vending yum-epel (0.6.0) to path/cookbooks/yum-epel
Vendoring yum-mysql-community (0.1.12) to path/cookbooks/yum-mysql-community
Uploading the kitchen...
Generating solo config...
Running Chef...
[2015-02-15T14:50:52 + 00:00] WARN:
SSL validation of HTTPS requests is disabled.HTTPS connections are still
encrypted, but check is not possible to detect forced replies or man in the middle
attacks.
To fix this issue add an entry like this to your configuration file:
``
# Verify all HTTPS connections (recommended)
ssl_verify_mode:verify_peer
#OR, Verify only connections to check-server
verify_api_cert true
`
To check your SSL configuration, or troubleshoot errors, you can use the
knife ssl check
command like so:
knife ssl check-c/home/ec2-user/chef-solo/solo.rb
Starting Chef Client, version 11.16.4
Compiling Cookbooks...
Converging 2 resources
recipe:sample:default
* mysql2_chef_gem [default] action install
recipe:build-essential::_rhel
* package [autoconf] action install (up to date)
* package [bison] action install (up to date)
* package [flex] action install (up to date)
* package [gcc] action install (up to date)
* package [gcc-c++]action install (up to date)
* package [kernel-develop] action install (up to date)
* package [make] action install (up to date)
* package [m4] action install (up to date)
* package [patch] action install (up to date)
* mysql_client [default] action create
================================================================================
Error executing action `create` on resource' mysql_client [default]'
================================================================================
NoMethodError
-------------
undefined method `[]' for nil: NilClass
Cookbook Trace:
---------------
/home/ec2-user/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:287:in`package_name_for'
/home/ec2-user/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:319:in`client_package'
/home/ec2-user/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:29:in`client_package_name'
/home/ec2-user/chef-solo/cookbooks-2/mysql/libraries/provider_mysql_client.rb:19:in`block in<class:MysqlClient>'
Resource Declaration:
---------------------
# In/home/ec2-user/chef-solo/cookbooks-2/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/home/ec2-user/chef-solo/cookbooks-2/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rb:16:in`block in<class:Mysql>'
mysql_client("default")do
action [:create]
retries0
retry_delay2
guard_interpreter —default
cookbook_name —sample
version "5.5"
end
================================================================================
Error executing action install
on resource'mysql2_chef_gem [default]'
================================================================================
NoMethodError
mysql_client [default] (/home/ec2-user/chef-solo/cookbooks-2/mysql2_chef_gem/libraries/provider_mysql2_chef_gem_mysql.rbline16) had an error: NoMethodError: undefined method [[for N]
Cookbook Trace:
/home/ec2-user/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:287:in package_name_for'
client_package'
/home/ec2-user/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:319:in
/home/ec2-user/chef-solo/cookbooks-2/mysql/libraries/helpers.rb:29:in client_package_name'
block in'
/home/ec2-user/chef-solo/cookbooks-2/mysql/libraries/provider_mysql_client.rb:19:in
Resource Declaration:
#In/home/ec2-user/chef-solo/cookbooks-3/sample/recipes/default.rb
9:mysql2_chef_gem'default'do
10: client_version node ['mysql'] ['version'] if node ['mysql']
11:action:install
12—end
13:
Compiled Resource:
# Declared in/home/ec2-user/chef-solo/cookbooks-3/sample/recipes/default.rb:9:in`from_file'
mysql2_chef_gem("default")do
action[:install]
retries0
retry_delay2
guard_interpreter:default
cookbook_name:sample
recipe_name "default"
client_version "5.5"
gem_version "0.3.17"
end
Running handlers:
[2015-02-15T14:50:55 + 00:00] ERROR:Running exception handlers
Running handlers complete
[2015-02-15T14:50:55 + 00:00] ERROR: Exception handlers complete
[2015-02-15T14:50:55 + 00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed.0 resources updated in 3.096810316 seconds
[2015-02-15T14:50:55+00:00] ERROR: mysql2_chef_gem [default] (sample::default line9) had an error: NoMethodError: mysql_client [default] (/home/ec2-user/chef-solo/cookbooks-2/mysql_cheferrors2/mysql_cheviribers2/mysql_chemys_chembrors2/mysqrors2/mysqrors2/mysq_chem_chem_chem_chem_
[2015-02-15T14:50:55 + 00:00] FATAL:Chef::Exceptions::ChildConvergeError:Chef run process expired successfully (exit code1)
I think the reason is that mysql.rb below is gone.
https://github.com/opscode-cookbooks/database/blob/v3.1.0/recipes/mysql.rb
Add dependents "mysql2_chef_gem" to sample/metadata.rb
At the beginning of sample/recipes/default.rb,
with the same contents as mysql.rb.mysql2_chef_gem'default'do
client_version node ['mysql']['version'] if node ['mysql']
action:install
end
Put down the
© 2024 OneMinuteCode. All rights reserved.