library/ipajoin.py: Enhanced tests for password and keytab

mutually_exclusive and required_one_of are only able to check if the parameters
are defined, but not if they are set to "".
This commit is contained in:
Thomas Woerner
2017-09-18 17:33:08 +02:00
parent bf64c0bb8f
commit 0a8672fcb5

View File

@@ -202,8 +202,6 @@ def main():
kinit_attempts=dict(required=False, type='int', default=5),
debug=dict(required=False, type='bool'),
),
mutually_exclusive = [['password','keytab']],
required_one_of = [['password', 'keytab']],
supports_check_mode = True,
)
@@ -222,6 +220,10 @@ def main():
kinit_attempts = module.params.get('kinit_attempts')
debug = module.params.get('debug')
if password is not None and password != "" and \
keytab is not None and keytab != "":
module.fail_json(msg="Password and keytab cannot be used together")
client_domain = hostname[hostname.find(".")+1:]
nolog = tuple()
env = {'PATH': SECURE_PATH}