cyberswat/drupal — pull request #15 by tannerjfco (2013-12-14 17:18:57+00:00)
Title: Update mysql.rb

(apologies in advance for the poor commit message)

My most recent attempt to spin up a drupal-lamp instance results in a compile error of the mysql recipe. Relevant log output:
```
================================================================================

Recipe Compile Error in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/drupal/recipes/mysql.rb

================================================================================

Chef::Exceptions::ImmutableAttributeModification

------------------------------------------------

Node attributes are read-only when you do not specify which precedence level to set. To set an attribute use code like `node.default["key"] = "value"'

Cookbook Trace:

---------------

/tmp/vagrant-chef-1/chef-solo-1/cookbooks/drupal/recipes/mysql.rb:31:in `from_file'

Relevant File Content:
----------------------
/tmp/vagrant-chef-1/chef-solo-1/cookbooks/drupal/recipes/mysql.rb:

24: include_recipe "database"
25: passwords = data_bag_item('users', 'mysql')[node.chef_environment]
26: Chef::Log::debug "drupal::mysql passwords = #{passwords.inspect}"
27:
28: if Chef::Config[:solo]
29: Chef::Log.debug "drupal::mysql Setting chef solo node mysql passwords."
30: node.set['mysql']['server_debian_password'] = passwords["debian"] unless passwords["debian"].nil?
31>> node[:mysql][:server_root_password] = passwords["root"] unless passwords["root"].nil?
32: node.set['mysql']['server_repl_password'] = passwords["replication"] unless passwords["replication"].nil?
33: end
34:
35: gem_package "mysql" if node[:db][:driver] == "mysql"
36:
37: mysql_connection_info = {
38: :host => node[:db][:host],
39: :username => node[:db][:root],
40: :password => node[:mysql][:server_root_password]
```

Updating the node attribute to node.default as suggested by the log output seems to allow chef to get past this particular issue.