From 48ecb92afdbd577fbb4fe05ea15cfaf44e504f89 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Feb 26 2020 07:05:31 +0000 Subject: Cherry-picked only ldapmodify_dm() Reviewed-By: Florence Blanc-Renaud --- diff --git a/ipatests/pytest_ipa/integration/tasks.py b/ipatests/pytest_ipa/integration/tasks.py index ee7bb24..48a7624 100755 --- a/ipatests/pytest_ipa/integration/tasks.py +++ b/ipatests/pytest_ipa/integration/tasks.py @@ -1827,3 +1827,21 @@ def get_logsize(host, logfile): """ get current logsize""" logsize = len(host.get_file_contents(logfile)) return logsize + + +def ldapmodify_dm(host, ldif_text, **kwargs): + """Run ldapmodify as Directory Manager + + :param host: host object + :param ldif_text: ldif string + :param kwargs: additional keyword arguments to run_command() + :return: result object + """ + # no hard-coded hostname, let ldapmodify pick up the host from ldap.conf. + args = [ + 'ldapmodify', + '-x', + '-D', str(host.config.dirman_dn), # pylint: disable=no-member + '-w', host.config.dirman_password + ] + return host.run_command(args, stdin_text=ldif_text, **kwargs)