mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Add missing MariaDB Grants to mysql module
MariaDB has added some grants in 10.4.x and 10.5.x that are not present here, which results in an error when creating. This is an addition to #59280. Also improved exception handling in `grant_add` which did not log the original error message and replaced it with a generic error.
This commit is contained in:
parent
427718c5ae
commit
efe2102b16
2 changed files with 18 additions and 13 deletions
3
changelog/61409.changed
Normal file
3
changelog/61409.changed
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
Add missing MariaDB Grants to mysql module.
|
||||||
|
MariaDB has added some grants in 10.4.x and 10.5.x that are not present here, which results in an error when creating.
|
||||||
|
Also improved exception handling in `grant_add` which did not log the original error message and replaced it with a generic error.
|
|
@ -78,11 +78,11 @@ __grants__ = [
|
||||||
"ALTER ROUTINE",
|
"ALTER ROUTINE",
|
||||||
"BACKUP_ADMIN",
|
"BACKUP_ADMIN",
|
||||||
"BINLOG_ADMIN",
|
"BINLOG_ADMIN",
|
||||||
"BINLOG ADMIN",
|
"BINLOG ADMIN", # MariaDB since 10.5.2
|
||||||
"BINLOG MONITOR",
|
"BINLOG MONITOR", # MariaDB since 10.5.2
|
||||||
"BINLOG REPLAY",
|
"BINLOG REPLAY", # MariaDB since 10.5.2
|
||||||
"CONNECTION_ADMIN",
|
"CONNECTION_ADMIN",
|
||||||
"CONNECTION ADMIN",
|
"CONNECTION ADMIN", # MariaDB since 10.5.2
|
||||||
"CREATE",
|
"CREATE",
|
||||||
"CREATE ROLE",
|
"CREATE ROLE",
|
||||||
"CREATE ROUTINE",
|
"CREATE ROUTINE",
|
||||||
|
@ -91,12 +91,13 @@ __grants__ = [
|
||||||
"CREATE USER",
|
"CREATE USER",
|
||||||
"CREATE VIEW",
|
"CREATE VIEW",
|
||||||
"DELETE",
|
"DELETE",
|
||||||
|
"DELETE HISTORY", # MariaDB since 10.3.4
|
||||||
"DROP",
|
"DROP",
|
||||||
"DROP ROLE",
|
"DROP ROLE",
|
||||||
"ENCRYPTION_KEY_ADMIN",
|
"ENCRYPTION_KEY_ADMIN",
|
||||||
"EVENT",
|
"EVENT",
|
||||||
"EXECUTE",
|
"EXECUTE",
|
||||||
"FEDERATED ADMIN",
|
"FEDERATED ADMIN", # MariaDB since 10.5.2
|
||||||
"FILE",
|
"FILE",
|
||||||
"GRANT OPTION",
|
"GRANT OPTION",
|
||||||
"GROUP_REPLICATION_ADMIN",
|
"GROUP_REPLICATION_ADMIN",
|
||||||
|
@ -105,26 +106,26 @@ __grants__ = [
|
||||||
"LOCK TABLES",
|
"LOCK TABLES",
|
||||||
"PERSIST_RO_VARIABLES_ADMIN",
|
"PERSIST_RO_VARIABLES_ADMIN",
|
||||||
"PROCESS",
|
"PROCESS",
|
||||||
"READ_ONLY ADMIN",
|
"READ_ONLY ADMIN", # MariaDB since 10.5.2
|
||||||
"REFERENCES",
|
"REFERENCES",
|
||||||
"RELOAD",
|
"RELOAD",
|
||||||
"REPLICA MONITOR",
|
"REPLICA MONITOR", # MariaDB since 10.5.9
|
||||||
"REPLICATION CLIENT",
|
"REPLICATION CLIENT",
|
||||||
"REPLICATION MASTER ADMIN",
|
"REPLICATION MASTER ADMIN", # MariaDB since 10.5.2
|
||||||
"REPLICATION REPLICA",
|
"REPLICATION REPLICA", # MariaDB since 10.5.1
|
||||||
"REPLICATION SLAVE",
|
"REPLICATION SLAVE",
|
||||||
"REPLICATION_SLAVE_ADMIN",
|
"REPLICATION_SLAVE_ADMIN",
|
||||||
"REPLICATION SLAVE ADMIN",
|
"REPLICATION SLAVE ADMIN", # MariaDB since 10.5.2
|
||||||
"RESOURCE_GROUP_ADMIN",
|
"RESOURCE_GROUP_ADMIN",
|
||||||
"RESOURCE_GROUP_USER",
|
"RESOURCE_GROUP_USER",
|
||||||
"ROLE_ADMIN",
|
"ROLE_ADMIN",
|
||||||
"SELECT",
|
"SELECT",
|
||||||
"SET USER",
|
"SET USER", # MariaDB since 10.5.2
|
||||||
"SET_USER_ID",
|
"SET_USER_ID",
|
||||||
"SHOW DATABASES",
|
"SHOW DATABASES",
|
||||||
"SHOW VIEW",
|
"SHOW VIEW",
|
||||||
"SHUTDOWN",
|
"SHUTDOWN",
|
||||||
"SLAVE MONITOR",
|
"SLAVE MONITOR", # MariaDB since 10.5.9
|
||||||
"SUPER",
|
"SUPER",
|
||||||
"SYSTEM_VARIABLES_ADMIN",
|
"SYSTEM_VARIABLES_ADMIN",
|
||||||
"TRIGGER",
|
"TRIGGER",
|
||||||
|
@ -2490,8 +2491,9 @@ def grant_exists(
|
||||||
|
|
||||||
try:
|
try:
|
||||||
target = __grant_generate(grant, database, user, host, grant_option, escape)
|
target = __grant_generate(grant, database, user, host, grant_option, escape)
|
||||||
except Exception: # pylint: disable=broad-except
|
except Exception as exc: # pylint: disable=broad-except
|
||||||
log.error("Error during grant generation.")
|
log.error("Error during grant generation.")
|
||||||
|
log.error(exc)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
grants = user_grants(user, host, **connection_args)
|
grants = user_grants(user, host, **connection_args)
|
||||||
|
|
Loading…
Add table
Reference in a new issue