URL: https://github.com/freeipa/freeipa/pull/4056
Author: mrizwan93
 Title: #4056: ipatests: Fix for PR#3773
Action: opened

PR body:
"""
Issue identified in PR3845, Hence the fix.

https://github.com/freeipa/freeipa/pull/3845
https://github.com/freeipa/freeipa/pull/3773

Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/4056/head:pr4056
git checkout pr4056
From 3ad13cfdbc14c4c63289b53088b997442232da0c Mon Sep 17 00:00:00 2001
From: Mohammad Rizwan Yusuf <myu...@redhat.com>
Date: Wed, 18 Dec 2019 13:18:11 +0530
Subject: [PATCH] Fix for PR#3773

Issue identified in PR3845, Hence the fix.

https://github.com/freeipa/freeipa/pull/3845
https://github.com/freeipa/freeipa/pull/3773

Signed-off-by: Mohammad Rizwan Yusuf <myu...@redhat.com>
---
 ipatests/pytest_ipa/integration/tasks.py       | 13 +++++++++++--
 ipatests/test_integration/test_installation.py | 11 +++++++----
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ipatests/pytest_ipa/integration/tasks.py b/ipatests/pytest_ipa/integration/tasks.py
index ba83491554..35e18f6f37 100644
--- a/ipatests/pytest_ipa/integration/tasks.py
+++ b/ipatests/pytest_ipa/integration/tasks.py
@@ -386,7 +386,7 @@ def replica_prepare(master, replica, extra_args=(),
 def install_replica(master, replica, setup_ca=True, setup_dns=False,
                     setup_kra=False, setup_adtrust=False, extra_args=(),
                     domain_level=None, unattended=True, stdin_text=None,
-                    raiseonerr=True):
+                    raiseonerr=True, promote=True):
     if domain_level is None:
         domain_level = domainlevel(master)
     apply_common_fixes(replica)
@@ -395,8 +395,17 @@ def install_replica(master, replica, setup_ca=True, setup_dns=False,
     # Otherwise ipa-client-install would not create a PTR
     # and replica installation would fail
     args = ['ipa-replica-install',
-            '-p', replica.config.dirman_password,
             '-w', replica.config.admin_password]
+
+    if promote:
+        # install client in replica first then promote it to be a replica
+        args.extend(['-p', replica.config.dirman_password])
+        install_client(master, replica)
+    else:
+        # provide authorize user and server to install against
+        args.extend(['--principal', replica.config.admin_name,
+                     '--server', master.hostname])
+
     if unattended:
         args.append('-U')
     if setup_ca:
diff --git a/ipatests/test_integration/test_installation.py b/ipatests/test_integration/test_installation.py
index fe80eb3bdf..554b27a39d 100644
--- a/ipatests/test_integration/test_installation.py
+++ b/ipatests/test_integration/test_installation.py
@@ -639,7 +639,8 @@ def install(cls, mh):
 
         # install replica1 without CA
         cmd = tasks.install_replica(cls.master, cls.replicas[0],
-                                    setup_ca=False, setup_dns=True)
+                                    setup_ca=False, setup_dns=True,
+                                    promote=False)
 
         # check for warning that CA is not installed on server
         warn = 'WARNING: The CA service is only installed on one server'
@@ -660,7 +661,7 @@ def test_replica_install_against_server_without_ca(self):
             # install replica2 against replica1, as CA is not installed on
             # replica1, installation on replica2 should fail
             cmd = tasks.install_replica(self.replicas[0], self.replicas[1],
-                                        raiseonerr=False)
+                                        raiseonerr=False, promote=False)
             assert cmd.returncode == 4
             error = "please provide a server with the CA role"
             assert error in cmd.stderr_text
@@ -680,7 +681,8 @@ def test_replica_install_against_server_without_kra(self):
             # install replica2 against replica1, as KRA is not installed on
             # replica1(CA installed), installation should fail on replica2
             cmd = tasks.install_replica(self.replicas[0], self.replicas[1],
-                                        setup_kra=True, raiseonerr=False)
+                                        setup_kra=True, raiseonerr=False
+                                        promote=False)
             assert cmd.returncode == 4
             error = "please provide a server with the KRA role"
             assert error in cmd.stderr_text
@@ -694,7 +696,8 @@ def test_replica_install_against_server(self):
         """Replica install should succeed if specified server provide all
         the services"""
 
-        tasks.install_replica(self.master, self.replicas[1], setup_dns=True)
+        tasks.install_replica(self.master, self.replicas[1], setup_dns=True,
+                              promote=False)
 
         # check if replication agreement stablished between master
         # and replica2 only.
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedorahosted.org/archives/list/freeipa-devel@lists.fedorahosted.org

Reply via email to