From 5f3784520b5183a75f85b3c235b1e9178c0d5e2f Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Tue, 6 Oct 2015 20:28:18 +0200 Subject: [PATCH] CI Test: add setup_kra options into install scripts https://fedorahosted.org/freeipa/ticket/5302 Reviewed-By: Milan Kubik --- ipatests/test_integration/tasks.py | 30 ++++++++++++++++--- .../test_backup_and_restore.py | 8 +---- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/ipatests/test_integration/tasks.py b/ipatests/test_integration/tasks.py index 7bfd12dce..918f78cde 100644 --- a/ipatests/test_integration/tasks.py +++ b/ipatests/test_integration/tasks.py @@ -246,7 +246,7 @@ def enable_replication_debugging(host): stdin_text=logging_ldif) -def install_master(host, setup_dns=True): +def install_master(host, setup_dns=True, setup_kra=False): host.collect_log(paths.IPASERVER_INSTALL_LOG) host.collect_log(paths.IPACLIENT_INSTALL_LOG) inst = host.domain.realm.replace('.', '-') @@ -273,10 +273,23 @@ def install_master(host, setup_dns=True): enable_replication_debugging(host) setup_sssd_debugging(host) + if setup_kra: + args = [ + "ipa-kra-install", + "-p", host.config.dirman_password, + "-U", + ] + host.run_command(args) + kinit_admin(host) -def install_replica(master, replica, setup_ca=True, setup_dns=False): +def get_replica_filename(replica): + return os.path.join(replica.config.test_dir, 'replica-info.gpg') + + +def install_replica(master, replica, setup_ca=True, setup_dns=False, + setup_kra=False): replica.collect_log(paths.IPAREPLICA_INSTALL_LOG) replica.collect_log(paths.IPAREPLICA_CONNCHECK_LOG) @@ -289,8 +302,7 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False): replica.hostname]) replica_bundle = master.get_file_contents( paths.REPLICA_INFO_GPG_TEMPLATE % replica.hostname) - replica_filename = os.path.join(replica.config.test_dir, - 'replica-info.gpg') + replica_filename = get_replica_filename(replica) replica.put_file_contents(replica_filename, replica_bundle) args = ['ipa-replica-install', '-U', '-p', replica.config.dirman_password, @@ -309,6 +321,16 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False): enable_replication_debugging(replica) setup_sssd_debugging(replica) + if setup_kra: + assert setup_ca, "CA must be installed on replica with KRA" + args = [ + "ipa-kra-install", + replica_filename, + "-p", replica.config.dirman_password, + "-U", + ] + replica.run_command(args) + kinit_admin(replica) diff --git a/ipatests/test_integration/test_backup_and_restore.py b/ipatests/test_integration/test_backup_and_restore.py index c0d30fc81..8b9cd2dc4 100644 --- a/ipatests/test_integration/test_backup_and_restore.py +++ b/ipatests/test_integration/test_backup_and_restore.py @@ -354,13 +354,7 @@ class BaseBackupAndRestoreWithKRA(IntegrationTest): @classmethod def install(cls, mh): - tasks.install_master(cls.master, setup_dns=True) - args = [ - "ipa-kra-install", - "-p", cls.master.config.dirman_password, - "-U", - ] - cls.master.run_command(args) + tasks.install_master(cls.master, setup_dns=True, setup_kra=True) def _full_backup_restore_with_vault(self, reinstall=False): with restore_checker(self.master):