Bläddra i källkod

fix, tests

pr/27
Petr Michalec 7 år sedan
förälder
incheckning
c721ed0fad
Inget konto är kopplat till bidragsgivarens mejladress
3 ändrade filer med 23 tillägg och 12 borttagningar
  1. +8
    -6
      galera/map.jinja
  2. +12
    -6
      galera/server.sls
  3. +3
    -0
      tests/pillar/master_cluster.sls

+ 8
- 6
galera/map.jinja Visa fil

@@ -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', {})) %}


+ 12
- 6
galera/server.sls Visa fil

@@ -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 @@ mysql_database_{{ database_name }}:
#- 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 @@ mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }}:
#- 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 @@ mysql_grants_{{ user.name }}_{{ database_name }}_{{ user.host }}:
- 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 @@ mysql_user_{{ user.name }}_{{ host }}_grants_db_{{ db.database }}_{{ loop.index0
#- 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 @@ mysql_user_{{ user.name }}_{{ host }}_grants_db_{{ db.database }}_{{ loop.index0
{%- endfor %}
{%- endfor %}

{%- endif %}
{%- endif %}

+ 3
- 0
tests/pillar/master_cluster.sls Visa fil

@@ -25,6 +25,9 @@
port: 9200
mysql:
server:
database:
mydb:
encoding: 'utf8'
users:
- name: haproxy
host: localhost

Laddar…
Avbryt
Spara