File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed
tests/integration/targets/test_mysql_user/tasks Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 1+ minor_changes :
2+ - mysql_query - simple refactoring of query type check (https://github.com/ansible-collections/community.mysql/pull/58).
3+ - mysql_user - simple refactoring of priv type check (https://github.com/ansible-collections/community.mysql/pull/58).
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ def main():
149149 config_file = module .params ['config_file' ]
150150 query = module .params ["query" ]
151151
152- if not isinstance (query , str ) and not isinstance ( query , list ):
152+ if not isinstance (query , ( str , list ) ):
153153 module .fail_json (msg = "the query option value must be a string or list, passed %s" % type (query ))
154154
155155 if isinstance (query , str ):
Original file line number Diff line number Diff line change @@ -1044,7 +1044,7 @@ def main():
10441044 plugin_hash_string = module .params ["plugin_hash_string" ]
10451045 plugin_auth_string = module .params ["plugin_auth_string" ]
10461046 resource_limits = module .params ["resource_limits" ]
1047- if priv and not ( isinstance (priv , str ) or isinstance ( priv , dict )):
1047+ if priv and not isinstance (priv , ( str , dict )):
10481048 module .fail_json (msg = "priv parameter must be str or dict but %s was passed" % type (priv ))
10491049
10501050 if priv and isinstance (priv , dict ):
Original file line number Diff line number Diff line change 192192 - " '%db' in result.stdout"
193193 - " 'SELECT' in result.stdout"
194194
195+ - name : test priv type check, must fail
196+ mysql_user :
197+ << : *mysql_params
198+ name : ' {{ user_name_1 }}'
199+ priv :
200+ - unsuitable
201+ - type
202+ append_privs : yes
203+ host_all : yes
204+ password : ' {{ user_password_1 }}'
205+ register : result
206+ ignore_errors : yes
207+
208+ - name : check fail message
209+ assert :
210+ that :
211+ - result is failed
212+ - result.msg is search('priv parameter must be str or dict')
213+
195214 - name : change user access to database via wildcard
196215 mysql_user :
197216 << : *mysql_params
You can’t perform that action at this time.
0 commit comments