<commit_before>include_recipe "database"

gem_package "mysql" do
  gem_binary "/opt/chef/embedded/bin/gem"
end

if node[:active_applications]

  node[:active_applications].each do |app, app_info|
    if app_info['database_info']

      database_info = app_info['database_info']

      mysql_connection_info = {:host => "localhost", :username => "root", :password => node['mysql']['server_root_password']}

      mysql_database database_info['database'] do
        connection(mysql_connection_info)
      end

      mysql_database_user app do
        connection(mysql_connection_info)
        username database_info['username']
        password database_info['password']
        database_name database_info['database']
        table "*"
        host "localhost"
        action :grant
      end

    end
  end

end<commit_msg>Update database cookbook with correct database info.<commit_after>include_recipe "database"

gem_package "mysql" do
  gem_binary "/opt/chef/embedded/bin/gem"
end

if node[:active_applications]

  node[:active_applications].each do |app, app_info|
    if app_info['database_info']

      database_info = app_info['database_info']
      database_name = app_info['database_info']['database']

      mysql_connection_info = {:host => "localhost", :username => "root", :password => node['mysql']['server_root_password']}

      mysql_database database_name do
        connection(mysql_connection_info)
      end

      mysql_database_user database_name do
        connection(mysql_connection_info)
        username database_info['username']
        password database_info['password']
        table "*"
        host "localhost"
        action :grant
      end

    end
  end

end
{'fraction_non_alphanumeric': 0.10135533294048321, 'fraction_numerical': 0.0, 'mean_word_length': 3.552278820375335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3729586', 'n_tokens_mistral': 492, 'n_tokens_neox': 473, 'n_words': 103}