ipaclient: Use omit (None) for password, keytab, no string length checks

Password and keytab do not need to be set explicitely to an empty string
when they are not set. Also there is no need to have string length checks
in the role tasks.
This commit is contained in:
Thomas Woerner
2019-06-14 17:26:12 +02:00
parent 813d5bbf97
commit da14fa29bb
2 changed files with 11 additions and 13 deletions

View File

@@ -161,8 +161,7 @@ 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 != "":
if password is not None and keytab is not None:
module.fail_json(msg="Password and keytab cannot be used together")
client_domain = hostname[hostname.find(".")+1:]
@@ -174,7 +173,7 @@ def main():
options.ca_cert_file = ca_cert_file
options.unattended = True
options.principal = principal if principal != "" else None
options.principal = principal
options.force = False
options.password = password
@@ -207,7 +206,7 @@ def main():
env['XMLRPC_TRACE_CURL'] = 'yes'
if force_join:
join_args.append("-f")
if principal:
if principal is not None:
if principal.find('@') == -1:
principal = '%s@%s' % (principal, realm)
try: