mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Trivial refactoring of the function mongodb.user_roles_exists
This commit is contained in:
parent
7c122944b4
commit
78bda200ad
@ -284,13 +284,12 @@ def user_roles_exists(name, roles, database, user=None, password=None, host=None
|
|||||||
salt '*' mongodb.user_roles_exists johndoe '["readWrite"]' dbname admin adminpwd localhost 27017
|
salt '*' mongodb.user_roles_exists johndoe '["readWrite"]' dbname admin adminpwd localhost 27017
|
||||||
salt '*' mongodb.user_roles_exists johndoe '[{"role": "readWrite", "db": "dbname" }, {"role": "read", "db": "otherdb"}]' dbname admin adminpwd localhost 27017
|
salt '*' mongodb.user_roles_exists johndoe '[{"role": "readWrite", "db": "dbname" }, {"role": "read", "db": "otherdb"}]' dbname admin adminpwd localhost 27017
|
||||||
'''
|
'''
|
||||||
output = user_list(user, password, host, port, database)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
roles = _to_dict(roles)
|
roles = _to_dict(roles)
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
return 'Roles provided in wrong format'
|
return 'Roles provided in wrong format'
|
||||||
|
|
||||||
|
output = user_list(user, password, host, port, database)
|
||||||
# an ugly temporary solution, the error handler need to be refactored
|
# an ugly temporary solution, the error handler need to be refactored
|
||||||
if output == 'Failed to connect to mongo database':
|
if output == 'Failed to connect to mongo database':
|
||||||
log.error(output)
|
log.error(output)
|
||||||
|
Loading…
Reference in New Issue
Block a user