<commit_before>class Puppet::Provider::Mysql < Puppet::Provider

  # Without initvars commands won't work.
  initvars

  # Make sure we find mysqld on CentOS
  ENV['PATH']=ENV['PATH'] + ':/usr/libexec'

  commands :mysql      => 'mysql'
  commands :mysqld     => 'mysqld'
  commands :mysqladmin => 'mysqladmin'

  # Optional defaults file
  def self.defaults_file
    if File.file?("#{Facter.value(:root_home)}/.my.cnf")
      "--defaults-extra-file=#{Facter.value(:root_home)}/.my.cnf"
    else
      nil
    end
  end

  def self.mysqld_type
    # find the mysql "dialect" like mariadb / mysql etc.
    mysqld_version_string.scan(/mariadb/i) { return "mariadb" }
    mysqld_version_string.scan(/\s\(mysql/i) { return "mysql" }
    mysqld_version_string.scan(/\s\(percona/i) { return "percona" }
    return "mysql"
  end

  def mysqld_type
    self.class.mysqld_type
  end

  def self.mysqld_version_string
    # we cache the result ...
    return @mysqld_version_string unless @mysqld_version_string.nil?
    @mysqld_version_string = mysqld(['-V'].compact)
    return @mysqld_version_string
  end

  def mysqld_version_string
    self.class.mysqld_version_string
  end

  def self.mysqld_version<commit_msg>Remove mysql regex when checking type<commit_after>class Puppet::Provider::Mysql < Puppet::Provider

  # Without initvars commands won't work.
  initvars

  # Make sure we find mysqld on CentOS
  ENV['PATH']=ENV['PATH'] + ':/usr/libexec'

  commands :mysql      => 'mysql'
  commands :mysqld     => 'mysqld'
  commands :mysqladmin => 'mysqladmin'

  # Optional defaults file
  def self.defaults_file
    if File.file?("#{Facter.value(:root_home)}/.my.cnf")
      "--defaults-extra-file=#{Facter.value(:root_home)}/.my.cnf"
    else
      nil
    end
  end

  def self.mysqld_type
    # find the mysql "dialect" like mariadb / mysql etc.
    mysqld_version_string.scan(/mariadb/i) { return "mariadb" }
    mysqld_version_string.scan(/\s\(percona/i) { return "percona" }
    return "mysql"
  end

  def mysqld_type
    self.class.mysqld_type
  end

  def self.mysqld_version_string
    # we cache the result ...
    return @mysqld_version_string unless @mysqld_version_string.nil?
    @mysqld_version_string = mysqld(['-V'].compact)
    return @mysqld_version_string
  end

  def mysqld_version_string
    self.class.mysqld_version_string
  end

  def self.mysqld_version
{'fraction_non_alphanumeric': 0.11690496215306981, 'fraction_numerical': 0.0, 'mean_word_length': 3.4219330855018586, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4123919', 'n_tokens_mistral': 882, 'n_tokens_neox': 844, 'n_words': 173}