@@ -155,10 +155,10 @@ def user_add(cursor, user, host, host_all, password, encrypted,
155
155
attributes , tls_requires , reuse_existing_password , module ):
156
156
# we cannot create users without a proper hostname
157
157
if host_all :
158
- return {'changed' : False , 'password_changed' : False }
158
+ return {'changed' : False , 'password_changed' : False , 'attributes' : {} }
159
159
160
160
if module .check_mode :
161
- return {'changed' : True , 'password_changed' : None }
161
+ return {'changed' : True , 'password_changed' : None , 'attributes' : {} }
162
162
163
163
# If attributes are set, perform a sanity check to ensure server supports user attributes before creating user
164
164
if attributes and not get_attribute_support (cursor ):
@@ -417,6 +417,7 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
417
417
privileges_revoke (cursor , user , host , db_table , revoke_privs , grant_option , maria_role )
418
418
if len (grant_privs ) > 0 :
419
419
privileges_grant (cursor , user , host , db_table , grant_privs , tls_requires , maria_role )
420
+ changed = True
420
421
421
422
# after privilege manipulation, compare privileges from before and now
422
423
after_priv = privileges_get (cursor , user , host , maria_role )
@@ -969,7 +970,7 @@ def get_attribute_support(cursor):
969
970
# information_schema.tables does not hold the tables within information_schema itself
970
971
cursor .execute ("SELECT attribute FROM INFORMATION_SCHEMA.USER_ATTRIBUTES LIMIT 0" )
971
972
cursor .fetchone ()
972
- except mysql_driver .OperationalError :
973
+ except mysql_driver .Error :
973
974
return False
974
975
975
976
return True
0 commit comments