<commit_before>{% from "percona/map.jinja" import percona_settings with context %}

{{ percona_settings.config_directory }}:
  file.directory:
    - makedirs: True
    - user: root
    - group: root
    - require_in:
      - pkg: percona_client

include:
  - .service

mysql_python_dep:
  pkg.installed:
    - name: {{ percona_settings.python_mysql }}
    - reload_modules: True


{% if 'config' in percona_settings and percona_settings.config is mapping %}
{% set global_params= {} %}
{%   if 'my.cnf' in percona_settings.config %}
{%     do global_params.update(percona_settings.config['my.cnf'].get('mysqld',{})) %}
{%   endif %}
{%   for file, content in percona_settings.config|dictsort %}
{%     do global_params.update(percona_settings.config[file].get('mysqld',{})) if file != 'my.cnf' %}
{%     if file == 'my.cnf' %}
{%       set filepath = percona_settings.my_cnf_path %}
{%     else %}
{%       set filepath = percona_settings.config_directory + '/' + file %}
{%     endif %}
{{ filepath }}:
  file.managed:
    - user: root
    - group: root
    - mode: 0644
    - source: salt://percona/files/mysql.cnf.j2
    - template: jinja
    - context:
        config: {{ content |default({}) }}
{%     if percona_settings.reload_on_change %}
    - watch_in:
      - service: percona_svc
{%     endif %}
{%   endfor %}
{% endif %}

{% for global, value in global_params.iteritems() %}
{{ global }}:
  percona.setglobal:
    - value: {{ value }}
    - connection_pass: {{ percona_settings.root_password }}
    - fail_on_missing: False
    - fail_on_readonly: False
    - require:
      - service: percona_svc
      - pkg: mysql_python_dep
{% endfor %}<commit_msg>Create tmpdir if it does not exist<commit_after>{% from "percona/map.jinja" import percona_settings with context %}

{{ percona_settings.config_directory }}:
  file.directory:
    - makedirs: True
    - user: root
    - group: root
    - require_in:
      - pkg: percona_client

include:
  - .service

mysql_python_dep:
  pkg.installed:
    - name: {{ percona_settings.python_mysql }}
    - reload_modules: True


{% if 'config' in percona_settings and percona_settings.config is mapping %}
{% set global_params= {} %}
{%   if 'my.cnf' in percona_settings.config %}
{%     do global_params.update(percona_settings.config['my.cnf'].get('mysqld',{})) %}
{%   endif %}
{%   for file, content in percona_settings.config|dictsort %}
{%     do global_params.update(percona_settings.config[file].get('mysqld',{})) if file != 'my.cnf' %}
{%     if file == 'my.cnf' %}
{%       set filepath = percona_settings.my_cnf_path %}
{%     else %}
{%       set filepath = percona_settings.config_directory + '/' + file %}
{%     endif %}
{{ filepath }}:
  file.managed:
    - user: root
    - group: root
    - mode: 0644
    - source: salt://percona/files/mysql.cnf.j2
    - template: jinja
    - context:
        config: {{ content |default({}) }}
{%     if percona_settings.reload_on_change %}
    - watch_in:
      - service: percona_svc
{%     endif %}
{%   endfor %}
{% endif %}

{% for global, value in global_params.iteritems() %}

{% if 'tmpdir' in global %}
{{ value }}:
  file.directory:
    - mode: 1777
    - makedirs: True
{% endif %}

{{ global }}:
  percona.setglobal:
    - value: {{ value }}
    - connection_pass: {{ percona_settings.root_password }}
    - fail_on_missing: False
    - fail_on_readonly: False
    - require:
      - service: percona_svc
      - pkg: mysql_python_dep
{% endfor %}
{'fraction_non_alphanumeric': 0.1527136258660508, 'fraction_numerical': 0.0040415704387990765, 'mean_word_length': 2.9690721649484537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6674294', 'n_tokens_mistral': 1312, 'n_tokens_neox': 1197, 'n_words': 237}