mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #46919 from boltronics/mysql_module_comparison_fixes
Replace failing is and is not tests with == and !=
This commit is contained in:
commit
4f78903f14
@ -1691,11 +1691,11 @@ def __grant_generate(grant,
|
|||||||
table = db_part[2]
|
table = db_part[2]
|
||||||
|
|
||||||
if escape:
|
if escape:
|
||||||
if dbc is not '*':
|
if dbc != '*':
|
||||||
# _ and % are authorized on GRANT queries and should get escaped
|
# _ and % are authorized on GRANT queries and should get escaped
|
||||||
# on the db name, but only if not requesting a table level grant
|
# on the db name, but only if not requesting a table level grant
|
||||||
dbc = quote_identifier(dbc, for_grants=(table is '*'))
|
dbc = quote_identifier(dbc, for_grants=(table == '*'))
|
||||||
if table is not '*':
|
if table != '*':
|
||||||
table = quote_identifier(table)
|
table = quote_identifier(table)
|
||||||
# identifiers cannot be used as values, and same thing for grants
|
# identifiers cannot be used as values, and same thing for grants
|
||||||
qry = 'GRANT {0} ON {1}.{2} TO %(user)s@%(host)s'.format(grant, dbc, table)
|
qry = 'GRANT {0} ON {1}.{2} TO %(user)s@%(host)s'.format(grant, dbc, table)
|
||||||
@ -1893,16 +1893,16 @@ def grant_revoke(grant,
|
|||||||
db_part = database.rpartition('.')
|
db_part = database.rpartition('.')
|
||||||
dbc = db_part[0]
|
dbc = db_part[0]
|
||||||
table = db_part[2]
|
table = db_part[2]
|
||||||
if dbc is not '*':
|
if dbc != '*':
|
||||||
# _ and % are authorized on GRANT queries and should get escaped
|
# _ and % are authorized on GRANT queries and should get escaped
|
||||||
# on the db name, but only if not requesting a table level grant
|
# on the db name, but only if not requesting a table level grant
|
||||||
s_database = quote_identifier(dbc, for_grants=(table is '*'))
|
s_database = quote_identifier(dbc, for_grants=(table == '*'))
|
||||||
if dbc is '*':
|
if dbc == '*':
|
||||||
# add revoke for *.*
|
# add revoke for *.*
|
||||||
# before the modification query send to mysql will looks like
|
# before the modification query send to mysql will looks like
|
||||||
# REVOKE SELECT ON `*`.* FROM %(user)s@%(host)s
|
# REVOKE SELECT ON `*`.* FROM %(user)s@%(host)s
|
||||||
s_database = dbc
|
s_database = dbc
|
||||||
if table is not '*':
|
if table != '*':
|
||||||
table = quote_identifier(table)
|
table = quote_identifier(table)
|
||||||
# identifiers cannot be used as values, same thing for grants
|
# identifiers cannot be used as values, same thing for grants
|
||||||
qry = 'REVOKE {0} ON {1}.{2} FROM %(user)s@%(host)s;'.format(
|
qry = 'REVOKE {0} ON {1}.{2} FROM %(user)s@%(host)s;'.format(
|
||||||
|
Loading…
Reference in New Issue
Block a user