Fix broken GRANT when not ssl

if ssl_option is not False, mysql_grant.present adds "REQUIRE" to the
grant command but since all the ssl sub options are false or missing,
there is a null string appended to the requirements. This causes the
grant command to fail.

This tests to see if ssl or X509 are set. If they're not, it skips the
entire ssl_option section leaving ssl_option==False to prevent that
error.
This commit is contained in:
Joe Julian 2016-09-07 09:20:10 -07:00 committed by Joe Julian
parent c6674034ee
commit 703388ec05

View file

@ -79,6 +79,7 @@ include:
- grant: {{db['grants']|join(",")}}
- database: '{{ db['database'] }}.{{ db['table'] | default('*') }}'
- grant_option: {{ db['grant_option'] | default(False) }}
{% if 'ssl' in user or 'ssl-X509' in user %}
- ssl_option:
- SSL: {{ user['ssl'] | default(False) }}
{% if user['ssl-X509'] is defined %}
@ -93,6 +94,7 @@ include:
{% if user['ssl-CIPHER'] is defined %}
- CIPHER: {{ user['ssl-CIPHER'] }}
{% endif %}
{% endif %}
- user: {{ name }}
- host: '{{ host }}'
- connection_host: '{{ mysql_host }}'