added additional check

This commit is contained in:
LAL2211 2022-04-06 13:34:20 -04:00
parent cda8a18fe3
commit b3f59537ca

View File

@ -84,14 +84,25 @@ def rbac_roles(*roles, node=None):
node.query(f"DROP ROLE IF EXISTS {role}")
def verify_ldap_user_exists(server, username, password):
# def verify_ldap_user_exists(server, username, password):
# """Check that LDAP user is defined on the LDAP server."""
# with By("searching LDAP database"):
# ldap_node = current().context.cluster.node(server)
# r = ldap_node.command(
# f"ldapwhoami -H ldap://localhost -D 'cn={user_name},ou=users,dc=company,dc=com' -w {password}"
# )
# assert r.exitcode == 0, error()
def verify_ldap_user_exists(server, username, password, check=False):
"""Check that LDAP user is defined on the LDAP server."""
with By("searching LDAP database"):
ldap_node = current().context.cluster.node(server)
r = ldap_node.command(
f"ldapwhoami -H ldap://localhost -D 'cn={user_name},ou=users,dc=company,dc=com' -w {password}"
)
assert r.exitcode == 0, error()
if check:
with By("searching LDAP database"):
ldap_node = current().context.cluster.node(server)
r = ldap_node.command(
f"ldapwhoami -H ldap://localhost -D 'cn={user_name},ou=users,dc=company,dc=com' -w {password}"
)
assert r.exitcode == 0, error()
def create_ldap_external_user_directory_config_content(