mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Replace failing is and is not tests with == and !=
With the introduction of unicode_literals, these str to unicode comparisons were incorrectly always returning False. Fixes #46917.
This commit is contained in:
parent
6503bf8dfa
commit
6837d6c138
1 changed files with 7 additions and 7 deletions
|
@ -1691,11 +1691,11 @@ def __grant_generate(grant,
|
|||
table = db_part[2]
|
||||
|
||||
if escape:
|
||||
if dbc is not '*':
|
||||
if dbc != '*':
|
||||
# _ and % are authorized on GRANT queries and should get escaped
|
||||
# on the db name, but only if not requesting a table level grant
|
||||
dbc = quote_identifier(dbc, for_grants=(table is '*'))
|
||||
if table is not '*':
|
||||
dbc = quote_identifier(dbc, for_grants=(table == '*'))
|
||||
if table != '*':
|
||||
table = quote_identifier(table)
|
||||
# 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)
|
||||
|
@ -1895,16 +1895,16 @@ def grant_revoke(grant,
|
|||
db_part = database.rpartition('.')
|
||||
dbc = db_part[0]
|
||||
table = db_part[2]
|
||||
if dbc is not '*':
|
||||
if dbc != '*':
|
||||
# _ and % are authorized on GRANT queries and should get escaped
|
||||
# on the db name, but only if not requesting a table level grant
|
||||
s_database = quote_identifier(dbc, for_grants=(table is '*'))
|
||||
if dbc is '*':
|
||||
s_database = quote_identifier(dbc, for_grants=(table == '*'))
|
||||
if dbc == '*':
|
||||
# add revoke for *.*
|
||||
# before the modification query send to mysql will looks like
|
||||
# REVOKE SELECT ON `*`.* FROM %(user)s@%(host)s
|
||||
s_database = dbc
|
||||
if table is not '*':
|
||||
if table != '*':
|
||||
table = quote_identifier(table)
|
||||
# identifiers cannot be used as values, same thing for grants
|
||||
qry = 'REVOKE {0} ON {1}.{2} FROM %(user)s@%(host)s;'.format(
|
||||
|
|
Loading…
Add table
Reference in a new issue