Skip to content
Snippets Groups Projects
Commit 71c12e4a authored by Eduardo Speroni's avatar Eduardo Speroni
Browse files

Added charset and collate support, ensuring backwards compatibility

parent 6403ba2e
Branches
Tags
No related merge requests found
......@@ -12,8 +12,9 @@
include:
- mysql.python
{% for database in salt['pillar.get']('mysql:database', []) %}
{% for database_obj in salt['pillar.get']('mysql:database', []) %}
{% set state_id = 'mysql_db_' ~ loop.index0 %}
{% set database = database_obj.get('name') if database_obj is mapping else database_obj %}
{{ state_id }}:
mysql_database.present:
- name: {{ database }}
......@@ -22,6 +23,10 @@ include:
{% if mysql_salt_pass %}
- connection_pass: '{{ mysql_salt_pass }}'
{% endif %}
{% if database_obj is mapping %}
- character_set: {{ database_obj.get('character_set', '') }}
- collate: {{ database_obj.get('collate', '') }}
{% endif %}
- connection_charset: utf8
{% if salt['pillar.get'](['mysql', 'schema', database, 'load']|join(':'), False) %}
......
......@@ -49,8 +49,12 @@ mysql:
# Manage databases
database:
# Simple definition using default charset and collate
- foo
- bar
# Detailed definition
- name: bar
character_set: utf8
collate: utf8_general_ci
schema:
foo:
load: True
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment