@@ -155,10 +155,10 @@ def user_add(cursor, user, host, host_all, password, encrypted,
155155 attributes , tls_requires , reuse_existing_password , module ):
156156 # we cannot create users without a proper hostname
157157 if host_all :
158- return {'changed' : False , 'password_changed' : False }
158+ return {'changed' : False , 'password_changed' : False , 'attributes' : {} }
159159
160160 if module .check_mode :
161- return {'changed' : True , 'password_changed' : None }
161+ return {'changed' : True , 'password_changed' : None , 'attributes' : {} }
162162
163163 # If attributes are set, perform a sanity check to ensure server supports user attributes before creating user
164164 if attributes and not get_attribute_support (cursor ):
@@ -417,6 +417,7 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
417417 privileges_revoke (cursor , user , host , db_table , revoke_privs , grant_option , maria_role )
418418 if len (grant_privs ) > 0 :
419419 privileges_grant (cursor , user , host , db_table , grant_privs , tls_requires , maria_role )
420+ changed = True
420421
421422 # after privilege manipulation, compare privileges from before and now
422423 after_priv = privileges_get (cursor , user , host , maria_role )
@@ -969,7 +970,7 @@ def get_attribute_support(cursor):
969970 # information_schema.tables does not hold the tables within information_schema itself
970971 cursor .execute ("SELECT attribute FROM INFORMATION_SCHEMA.USER_ATTRIBUTES LIMIT 0" )
971972 cursor .fetchone ()
972- except mysql_driver .OperationalError :
973+ except mysql_driver .Error :
973974 return False
974975
975976 return True
0 commit comments