bnr: Fixed the ERROR 1141 when users has fqdn

When the environment is deployed with TLS-e, the galera database has the user associates to these
hosts:
 - %
 - VIP
 - FQDN

The grants for the hosts % and VIP are populated. The FQDN ones are not populated.
So when the script to backup the grant of the users is executed, it shows an
irrelevant error like:

ERROR 1141 (42000) at line 1: There is no such grant defined for user "cinder"
on host "control.internal.api.example".

This patch backs up the grants of the users associate to:
 - %
 - localhost
 - IPV4
 - IPV6

Change-Id: I2b0c9a443cc1167a0183daf59ec2db3d4fc07d74
This commit is contained in:
Juan Badia Payno 2021-09-07 15:39:41 +02:00
parent 82aeb6d602
commit 669b4f0192
1 changed files with 2 additions and 1 deletions

View File

@ -123,7 +123,8 @@
{{ tripleo_container_cli }} exec {{ tripleo_backup_and_restore_mysql_container }} bash -c "mysql -uroot \
-p{{ mysql_password.stdout }} -s -N \
-e \"SELECT CONCAT('\\\"SHOW GRANTS FOR ''',user,'''@''',host,''';\\\"') \
FROM mysql.user where (length(user) > 0 and user NOT LIKE 'root')\" | xargs -n1 mysql \
FROM mysql.user where (length(user) > 0 and user NOT LIKE 'root' and \
(Host = 'localhost' or Host='%' or IS_IPV4(Host) or IS_IPV6(Host)))\" | xargs -n1 mysql \
-uroot -p{{ mysql_password.stdout }} -s -N -e | sed 's/$/;/' " > {{ tripleo_backup_and_restore_mysql_grants_file }}
when: mysql_password.stderr is defined
tags: