fix, tests
diff --git a/galera/map.jinja b/galera/map.jinja
index 12d6856..96f3736 100644
--- a/galera/map.jinja
+++ b/galera/map.jinja
@@ -57,17 +57,19 @@
}, grain='oscodename', merge=pillar.galera.get('slave', {}))) %}
{% set clustercheck = salt['grains.filter_by']({
- 'default': {
- 'enabled': False,
- 'user': clustercheck,
- 'password': clustercheck,
- 'port': '9200'
- },
'Debian': {
'config': '/etc/mysql/my.cnf',
+ 'enabled': False,
+ 'user': clustercheck,
+ 'password': clustercheck,
+ 'port': '9200'
},
'RedHat': {
'config': '/etc/my.cnf',
+ 'enabled': False,
+ 'user': clustercheck,
+ 'password': clustercheck,
+ 'port': '9200'
},
}, merge=pillar.galera.get('clustercheck', {})) %}
diff --git a/galera/server.sls b/galera/server.sls
index 84cb7c5..487a8cd 100644
--- a/galera/server.sls
+++ b/galera/server.sls
@@ -4,7 +4,6 @@
{%- for database_name, database in server.get('database', {}).iteritems() %}
-{%- if not grains.get('noservices', False) %}
mysql_database_{{ database_name }}:
mysql_database.present:
- name: {{ database_name }}
@@ -12,10 +11,11 @@
#- connection_user: {{ connection.user }}
#- connection_pass: {{ connection.password }}
#- connection_charset: {{ connection.charset }}
-{%- endif %}
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
{%- for user in database.users %}
-{%- if not grains.get('noservices', False) %}
mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }}:
mysql_user.present:
- host: '{{ user.host }}'
@@ -28,6 +28,9 @@
#- connection_user: {{ connection.user }}
#- connection_pass: {{ connection.password }}
#- connection_charset: {{ connection.charset }}
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
mysql_grants_{{ user.name }}_{{ database_name }}_{{ user.host }}:
mysql_grants.present:
@@ -41,7 +44,9 @@
- require:
- mysql_user: mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }}
- mysql_database: mysql_database_{{ database_name }}
-{%- endif %}
+ {%- if grains.get('noservices') %}
+ - onlyif: /bin/false
+ {%- endif %}
{%- endfor %}
{%- if database.initial_data is defined %}
@@ -122,7 +127,8 @@
#- connection_charset: {{ connection.charset }}
- require:
- mysql_user_{{ user.name }}_{{ host }}
- - mysql_database_{{ db.database }}
+ # the following line is not mandatory as database might not be managed by salt formula
+ #- mysql_database_{{ db.database }}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
@@ -132,4 +138,4 @@
{%- endfor %}
{%- endfor %}
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/tests/pillar/master_cluster.sls b/tests/pillar/master_cluster.sls
index bd27fa2..b0c12cc 100644
--- a/tests/pillar/master_cluster.sls
+++ b/tests/pillar/master_cluster.sls
@@ -25,6 +25,9 @@
port: 9200
mysql:
server:
+ database:
+ mydb:
+ encoding: 'utf8'
users:
- name: haproxy
host: localhost