Ver código fonte

fix, tests

pr/27
Petr Michalec 7 anos atrás
pai
commit
c721ed0fad
Nenhuma conta vinculada ao e-mail do autor do commit
3 arquivos alterados com 23 adições e 12 exclusões
  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 Ver arquivo

}, grain='oscodename', merge=pillar.galera.get('slave', {}))) %} }, grain='oscodename', merge=pillar.galera.get('slave', {}))) %}


{% set clustercheck = salt['grains.filter_by']({ {% set clustercheck = salt['grains.filter_by']({
'default': {
'enabled': False,
'user': clustercheck,
'password': clustercheck,
'port': '9200'
},
'Debian': { 'Debian': {
'config': '/etc/mysql/my.cnf', 'config': '/etc/mysql/my.cnf',
'enabled': False,
'user': clustercheck,
'password': clustercheck,
'port': '9200'
}, },
'RedHat': { 'RedHat': {
'config': '/etc/my.cnf', 'config': '/etc/my.cnf',
'enabled': False,
'user': clustercheck,
'password': clustercheck,
'port': '9200'
}, },
}, merge=pillar.galera.get('clustercheck', {})) %} }, merge=pillar.galera.get('clustercheck', {})) %}



+ 12
- 6
galera/server.sls Ver arquivo



{%- for database_name, database in server.get('database', {}).iteritems() %} {%- for database_name, database in server.get('database', {}).iteritems() %}


{%- if not grains.get('noservices', False) %}
mysql_database_{{ database_name }}: mysql_database_{{ database_name }}:
mysql_database.present: mysql_database.present:
- name: {{ database_name }} - name: {{ database_name }}
#- connection_user: {{ connection.user }} #- connection_user: {{ connection.user }}
#- connection_pass: {{ connection.password }} #- connection_pass: {{ connection.password }}
#- connection_charset: {{ connection.charset }} #- connection_charset: {{ connection.charset }}
{%- endif %}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}


{%- for user in database.users %} {%- for user in database.users %}
{%- if not grains.get('noservices', False) %}
mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }}: mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }}:
mysql_user.present: mysql_user.present:
- host: '{{ user.host }}' - host: '{{ user.host }}'
#- connection_user: {{ connection.user }} #- connection_user: {{ connection.user }}
#- connection_pass: {{ connection.password }} #- connection_pass: {{ connection.password }}
#- connection_charset: {{ connection.charset }} #- connection_charset: {{ connection.charset }}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}


mysql_grants_{{ user.name }}_{{ database_name }}_{{ user.host }}: mysql_grants_{{ user.name }}_{{ database_name }}_{{ user.host }}:
mysql_grants.present: mysql_grants.present:
- require: - require:
- mysql_user: mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }} - mysql_user: mysql_user_{{ user.name }}_{{ database_name }}_{{ user.host }}
- mysql_database: mysql_database_{{ database_name }} - mysql_database: mysql_database_{{ database_name }}
{%- endif %}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
{%- endfor %} {%- endfor %}


{%- if database.initial_data is defined %} {%- if database.initial_data is defined %}
#- connection_charset: {{ connection.charset }} #- connection_charset: {{ connection.charset }}
- require: - require:
- mysql_user_{{ user.name }}_{{ host }} - 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') %} {%- if grains.get('noservices') %}
- onlyif: /bin/false - onlyif: /bin/false
{%- endif %} {%- endif %}
{%- endfor %} {%- endfor %}
{%- endfor %} {%- endfor %}


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

+ 3
- 0
tests/pillar/master_cluster.sls Ver arquivo

port: 9200 port: 9200
mysql: mysql:
server: server:
database:
mydb:
encoding: 'utf8'
users: users:
- name: haproxy - name: haproxy
host: localhost host: localhost

Carregando…
Cancelar
Salvar