ubuntu13.10にopscode-cookbooks/mysql使ってmysqlインストールする時のエラー解決【暫定】

opscode-cookbooks/mysqlにはまだubuntu13.10に対応したtemplatesがないのでcookbooksのmysqlでインストールしようとすると↓のエラーがでる

```shell-session
================================================================================
Error executing action `create` on resource 'template[/etc/init/mysql.conf]'
================================================================================


Chef::Exceptions::FileNotFound
------------------------------
Cookbook 'mysql' (4.0.18) does not contain a file at any of these locations:
  templates/ubuntu-13.10/init-mysql.conf.erb
  templates/ubuntu/init-mysql.conf.erb
  templates/default/init-mysql.conf.erb

This cookbook _does_ contain: ['/home/vagrant/chef-solo/cookbooks-2/mysql/templates/ubuntu-10/init-mysql.conf.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/mysql-server.seed.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/usr.sbin.mysqld.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/grants.sql.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/my.cnf.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/debian.cnf.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/port_mysql.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/windows/my.ini.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/ubuntu-12/init-mysql.conf.erb']


Resource Declaration:
---------------------
# In /home/vagrant/chef-solo/cookbooks-2/mysql/recipes/_server_debian.rb

 77: template '/etc/init/mysql.conf' do
 78:   source 'init-mysql.conf.erb'
 79: end
 80: 



Compiled Resource:
------------------
# Declared in /home/vagrant/chef-solo/cookbooks-2/mysql/recipes/_server_debian.rb:77:in `from_file'

template("/etc/init/mysql.conf") do
  provider Chef::Provider::Template
  action "create"
  retries 0
  retry_delay 2
  path "/etc/init/mysql.conf"
  backup 5
  atomic_update true
  source "init-mysql.conf.erb"
  cookbook_name :mysql
  recipe_name "_server_debian"
end



[2014-01-11T16:46:43+00:00] ERROR: Running exception handlers
[2014-01-11T16:46:43+00:00] ERROR: Exception handlers complete
[2014-01-11T16:46:43+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 2 resources updated
[2014-01-11T16:46:43+00:00] ERROR: template[/etc/init/mysql.conf] (mysql::_server_debian line 77) had an error: Chef::Exceptions::FileNotFound: Cookbook 'mysql' (4.0.18) does not contain a file at any of these locations:
  templates/ubuntu-13.10/init-mysql.conf.erb
  templates/ubuntu/init-mysql.conf.erb
  templates/default/init-mysql.conf.erb

This cookbook _does_ contain: ['/home/vagrant/chef-solo/cookbooks-2/mysql/templates/ubuntu-10/init-mysql.conf.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/mysql-server.seed.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/usr.sbin.mysqld.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/grants.sql.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/my.cnf.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/debian.cnf.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/default/port_mysql.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/windows/my.ini.erb','/home/vagrant/chef-solo/cookbooks-2/mysql/templates/ubuntu-12/init-mysql.conf.erb']
[2014-01-11T16:46:43+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

# 要はinit-mysql.conf.erbがないと。
```

で、これを解決する方法として暫定で既存templatesをローカルにコピーする

```shell-session
cd chef-repo
git clone https://github.com/opscode-cookbooks/mysql
mkdir -p cookbooks/mysql/templates
cp -r mysql/templates/default cookbooks/mysql/templates/default
cp -r mysql/templates/ubuntu-12 cookbooks/mysql/templates/ubuntu-13.10
```

> opscode-cookbooks/mysqlのupdateに追従できないのであくまで暫定的な対処

`templates/default`もコピーしないと↓のようなエラーがでる

```shell-session
================================================================================
Error executing action `reload` on resource 'service[mysql]'
================================================================================


Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /etc/init.d/mysql reload ----
STDOUT: * Reloading MySQL database server mysqld
STDERR: /usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
---- End output of /etc/init.d/mysql reload ----
Ran /etc/init.d/mysql reload returned 1


Resource Declaration:
---------------------
# In /home/vagrant/chef-solo/cookbooks-2/mysql/recipes/_server_debian.rb

117: service 'mysql' do
118:   service_name 'mysql'
119:   supports     :status => true, :restart => true, :reload => true
120:   action       [:enable, :start]
121: end



Compiled Resource:
------------------
# Declared in /home/vagrant/chef-solo/cookbooks-2/mysql/recipes/_server_debian.rb:117:in `from_file'

service("mysql") do
  action [:enable, :start]
  updated true
  supports {:status=>true, :restart=>true, :reload=>true}
  retries 0
  retry_delay 2
  service_name "mysql"
  enabled true
  running true
  pattern "mysql"
  startup_type :automatic
  cookbook_name :mysql
  recipe_name "_server_debian"
end



[2014-01-11T17:01:13+00:00] ERROR: Running exception handlers
[2014-01-11T17:01:13+00:00] ERROR: Exception handlers complete
[2014-01-11T17:01:13+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 33 resources updated
[2014-01-11T17:01:14+00:00] ERROR: service[mysql] (mysql::_server_debian line 117) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of /etc/init.d/mysql reload ----
STDOUT: * Reloading MySQL database server mysqld
STDERR: /usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'
---- End output of /etc/init.d/mysql reload ----
Ran /etc/init.d/mysql reload returned 1
[2014-01-11T17:01:14+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
ERROR: RuntimeError: chef-solo failed. See output above.

# 要はdebian-sys-maintがちゃんと設定されてないと。
```

参考:
- http://fujishinko.exblog.jp/9334055/
- http://stackoverflow.com/questions/11644300/access-denied-for-user-debian-sys-maint