URL: https://github.com/freeipa/freeipa/pull/416
Author: frasertweedale
 Title: #416: replica install: relax domain level check for promotion
Action: opened

PR body:
"""
promote_check currently requires DL == 1.  Relax the check to
require DL >= 1, so that things will work for future DL increases.

Part of: https://fedorahosted.org/freeipa/ticket/5011
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/416/head:pr416
git checkout pr416
From a97b9dba6f1768356d7ce9feac8dc46da4ff8f83 Mon Sep 17 00:00:00 2001
From: Fraser Tweedale <ftwee...@redhat.com>
Date: Fri, 6 Jan 2017 16:04:10 +1000
Subject: [PATCH] replica install: relax domain level check for promotion

promote_check currently requires DL == 1.  Relax the check to
require DL >= 1, so that things will work for future DL increases.

Part of: https://fedorahosted.org/freeipa/ticket/5011
---
 ipaserver/install/server/replicainstall.py | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
index 18222c8..cf29710 100644
--- a/ipaserver/install/server/replicainstall.py
+++ b/ipaserver/install/server/replicainstall.py
@@ -556,7 +556,13 @@ def common_check(no_ntp):
             pass
 
 
-def check_domain_level(api, expected):
+def check_domain_level(api, expected=None, minimum=None):
+    """Check the domain level.
+
+    :param expected: if given, assert that current DL == expected
+    :param minimum: if given, assert that current DL >= minimum
+
+    """
     # Detect the current domain level
     try:
         current = api.Command['domainlevel_get']()['result']
@@ -576,14 +582,16 @@ def check_domain_level(api, expected):
             "{dl}:\n"
             "\tDomain level 0 requires a replica file as a positional "
             "arugment.\n"
-            "\tFor domain level 1 replica instalation, a replica file must "
+            "\tFor domain level >= 1 replica instalation, a replica file must "
             "not be used but you can can join the domain by running "
             "ipa-client-install first and then try"
             "to run this installation again."
             .format(dl=expected)
         )
 
-    if current != expected:
+    if current is not None and current != expected:
+        raise RuntimeError(message)
+    if minimum is not None and current < minimum:
         raise RuntimeError(message)
 
     # Detect if current level is out of supported range
@@ -1088,7 +1096,7 @@ def promote_check(installer):
                                      config.master_host_name, None)
 
         promotion_check_ipa_domain(conn, remote_api.env.basedn)
-        check_domain_level(remote_api, expected=constants.DOMAIN_LEVEL_1)
+        check_domain_level(remote_api, minimum=constants.DOMAIN_LEVEL_1)
 
         # Check authorization
         result = remote_api.Command['hostgroup_find'](
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to