<commit_before>## Begin MySQL manifest

if $mysql_values == undef {
  $mysql_values = hiera('mysql', false)
}

if $php_values == undef {
  $php_values = hiera('php', false)
}

if $mysql_values['root_password'] {
  class { 'mysql::server':
    root_password => $mysql_values['root_password'],
  }

  if is_hash($mysql_values['databases']) and count($mysql_values['databases']) > 0 {
    create_resources(mysql_db, $mysql_values['databases'])
  }

  if is_hash($php_values) {
    ensure_packages( ['php5-mysql'] )
  }
}

define mysql_db (
  $user,
  $password,
  $host,
  $grant    = [],
  $sql_file = false
) {
  mysql::db { $name:
    user     => $user,
    password => <PASSWORD>,
    host     => $host,
    grant    => $grant
  }

  if $sql_file {
    $table = "${name}.*"

    exec{ "${name}-import":
      command     => "mysql ${name} < ${sql_file}",
      logoutput   => true,
      environment => "HOME=${mysql::root_home}",
      refreshonly => $refresh,
      require     => Mysql_grant["${user}@${host}/${table}"],
      subscribe   => Mysql_database[$name],
      onlyif      => "test -f ${sql_file}"
    }
  }
}<commit_msg>Fixed broken mysql file import. Closed #192<commit_after>## Begin MySQL manifest

if $mysql_values == undef {
  $mysql_values = hiera('mysql', false)
}

if $php_values == undef {
  $php_values = hiera('php', false)
}

if $mysql_values['root_password'] {
  class { 'mysql::server':
    root_password => $mysql_values['root_password'],
  }

  if is_hash($mysql_values['databases']) and count($mysql_values['databases']) > 0 {
    create_resources(mysql_db, $mysql_values['databases'])
  }

  if is_hash($php_values) {
    ensure_packages( ['php5-mysql'] )
  }
}

define mysql_db (
  $user,
  $password,
  $host,
  $grant    = [],
  $sql_file = false
) {
  mysql::db { $name:
    user     => $user,
    password => $password,
    host     => $host,
    grant    => $grant
  }

  if $sql_file {
    $table = "${name}.*"

    exec{ "${name}-import":
      command     => "mysql ${name} < ${sql_file}",
      logoutput   => true,
      refreshonly => $refresh,
      require     => Database_grant["${user}@${host}/${table}"],
      subscribe   => Database[$name],
      onlyif      => "test -f ${sql_file}"
    }
  }
}
{'fraction_non_alphanumeric': 0.1824655095683133, 'fraction_numerical': 0.003115264797507788, 'mean_word_length': 3.0504504504504504, 'pattern_counts': {'":': 2, '<': 6, '<?xml version=': 0, '>': 29, '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': '2278453', 'n_tokens_mistral': 804, 'n_tokens_neox': 776, 'n_words': 154}