Commit c66d2c11 by Joseph Mulloy

Add check to prevent invalid mongo rs config

This is to prevent the situation described in the
following Mongo Jira ticket.

https://jira.mongodb.org/browse/SERVER-24887
parent 49a6c930
......@@ -351,6 +351,12 @@ def validate_args():
if (username and not password) or (password and not username):
module.fail_json(msg="Must provide both username and password or neither.")
# Check that if votes is 0 priority is also 0
for member in module.params.get('rs_config').get('members'):
if member.get('votes') == 0 and member.get('priority') != 0:
module.fail_json(msg="Non-voting member {} must have priority 0".
format(member['host']))
return module
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment