<commit_before>passwords = EncryptedPasswords.new(node, node["percona"]["encrypted_data_bag"])

# define access grants
template "/etc/mysql/grants.sql" do
  source "grants.sql.erb"
  variables(
    :root_password        => <PASSWORD>,
    :debian_user          => node["percona"]["server"]["debian_username"],
    :debian_password      => <PASSWORD>,
    :backup_password      => <PASSWORD>
  )
  owner "root"
  group "root"
  mode "0600"
end

# execute access grants
if passwords.root_password && !passwords.root_password.empty?
  # Intent is to check whether the root_password works, and use it to 
  # load the grants if so.  If not, try loading without a password 
  # and see if we get lucky
  execute "mysql-install-privileges" do
    command "/usr/bin/mysql -p '" + passwords.root_password + "' -e '' &> /dev/null > /dev/null &> /dev/null ; if [ $? -eq 0 ] ; then /usr/bin/mysql -p'" + passwords.root_password + "' < /etc/mysql/grants.sql ; else /usr/bin/mysql < /etc/mysql/grants.sql ; fi ;"
    action :nothing
    subscribes :run, resources("template[/etc/mysql/grants.sql]"), :immediately
  end
else
  # Simpler path...  just try running the grants command
  execute "mysql-install-privileges" do
    command "/usr/bin/mysql < /etc/mysql/grants.sql"
    action :nothing
    subscribes :run, resources("template[/etc/mysql/grants.sql]"), :immediately
  end
end
  
<commit_msg>Remove an errant space before the mysql password<commit_after>passwords = EncryptedPasswords.new(node, node["percona"]["encrypted_data_bag"])

# define access grants
template "/etc/mysql/grants.sql" do
  source "grants.sql.erb"
  variables(
    :root_password        => <PASSWORD>,
    :debian_user          => node["percona"]["server"]["debian_username"],
    :debian_password      => <PASSWORD>,
    :backup_password      => <PASSWORD>
  )
  owner "root"
  group "root"
  mode "0600"
end

# execute access grants
if passwords.root_password && !passwords.root_password.empty?
  # Intent is to check whether the root_password works, and use it to 
  # load the grants if so.  If not, try loading without a password 
  # and see if we get lucky
  execute "mysql-install-privileges" do
    command "/usr/bin/mysql -p'" + passwords.root_password + "' -e '' &> /dev/null > /dev/null &> /dev/null ; if [ $? -eq 0 ] ; then /usr/bin/mysql -p'" + passwords.root_password + "' < /etc/mysql/grants.sql ; else /usr/bin/mysql < /etc/mysql/grants.sql ; fi ;"
    action :nothing
    subscribes :run, resources("template[/etc/mysql/grants.sql]"), :immediately
  end
else
  # Simpler path...  just try running the grants command
  execute "mysql-install-privileges" do
    command "/usr/bin/mysql < /etc/mysql/grants.sql"
    action :nothing
    subscribes :run, resources("template[/etc/mysql/grants.sql]"), :immediately
  end
end
  

{'fraction_non_alphanumeric': 0.13898788310762653, 'fraction_numerical': 0.003563791874554526, 'mean_word_length': 3.3928012519561817, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 23, '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': '1427266', 'n_tokens_mistral': 943, 'n_tokens_neox': 920, 'n_words': 239}