<commit_before>require 'shellwords'

passwords = EncryptedPasswords.new(node, node["percona"]["encrypted_data_bag"])
replication_sql = "/etc/mysql/replication.sql"
server = node.percona.server

# define access grants
template replication_sql do
  source "replication_#{server.role}.sql.erb"
  variables(replication_password: <PASSWORD>.replication_password)
  owner "root"
  group "root"
  mode "0600"

  only_if do
    node["percona"]["server"]["replication"]["host"] != "" ||
      node["percona"]["server"]["role"] == "master"
  end
end

root_pass = <PASSWORD>.to_s
root_pass = Shellwords.escape(root_pass).prepend('-p') unless root_pass.empty?

execute "mysql-set-replication" do
  command "/usr/bin/mysql #{root_pass} < /etc/mysql/replication.sql"
  action :nothing
  subscribes :run, resources("template[/etc/mysql/replication.sql]"), :immediately
end<commit_msg>style cleanup, make tests pass<commit_after>require "shellwords"

passwords = EncryptedPasswords.new(node, node["percona"]["encrypted_data_bag"])
replication_sql = "/etc/mysql/replication.sql"
server = node["percona"]["server"]

# define access grants
template replication_sql do
  source "replication_#{server["role"]}.sql.erb"
  variables(replication_password: <PASSWORD>.replication_password)
  owner "root"
  group "root"
  mode "0600"

  only_if { server["replication"]["host"] != "" || server["role"] == "master" }
end

root_pass = <PASSWORD>.root_password.to_s
root_pass = Shellwords.escape(root_pass).prepend("-p") unless root_pass.empty?

execute "mysql-set-replication" do
  command "/usr/bin/mysql #{root_pass} < #{replication_sql}"
  action :nothing
  subscribes :run, resources("template[#{replication_sql}]"), :immediately
end
{'fraction_non_alphanumeric': 0.155061439438268, 'fraction_numerical': 0.004681100058513751, 'mean_word_length': 6.276595744680851, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '7424007', 'n_tokens_mistral': 571, 'n_tokens_neox': 579, 'n_words': 105}