pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone

Blame SOURCES/0010-Handle_NTP_configuration_in_replica_server_installation_f3e3da5_rhbz#1651679.patch

6d47df
From f3e3da509329881c4ba770d1f9418ad180ee98ae Mon Sep 17 00:00:00 2001
6d47df
From: Rob Crittenden <rcritten@redhat.com>
6d47df
Date: Oct 19 2018 17:35:05 +0000
6d47df
Subject: Handle NTP configuration in a replica server installation
6d47df
6d47df
6d47df
There were two separate issues:
6d47df
6d47df
1. If not enrolling on a pre-configured client then the ntp-server and
6d47df
   ntp-pool options are not being passed down to the client installer
6d47df
   invocation.
6d47df
2. If the client is already enrolled then the ntp options are ignored
6d47df
   altogether.
6d47df
6d47df
In the first case simply pass down the options to the client
6d47df
installer invocation.
6d47df
6d47df
If the client is pre-enrolled and NTP options are provided then
6d47df
raise an exception.
6d47df
6d47df
https://pagure.io/freeipa/issue/7723
6d47df
6d47df
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
6d47df
Reviewed-By: Florence Blanc-Renaud <frenaud@redhat.com>
6d47df
6d47df
---
6d47df
6d47df
diff --git a/install/tools/man/ipa-replica-install.1 b/install/tools/man/ipa-replica-install.1
6d47df
index 7f6ca57..c63107d 100644
6d47df
--- a/install/tools/man/ipa-replica-install.1
6d47df
+++ b/install/tools/man/ipa-replica-install.1
6d47df
@@ -14,7 +14,7 @@ Domain level 0 is not supported anymore.
6d47df
 
6d47df
 To create a replica, the machine only needs to be enrolled in the FreeIPA domain first. This process of turning the IPA client into a replica is also referred to as replica promotion.
6d47df
 
6d47df
-If you're starting with an existing IPA client, simply run ipa\-replica\-install to have it promoted into a replica.
6d47df
+If you're starting with an existing IPA client, simply run ipa\-replica\-install to have it promoted into a replica. The NTP configuration cannot be updated during client promotion. 
6d47df
 
6d47df
 To promote a blank machine into a replica, you have two options, you can either run ipa\-client\-install in a separate step, or pass the enrollment related options to the ipa\-replica\-install (see CLIENT ENROLLMENT OPTIONS). In the latter case, ipa\-replica\-install will join the machine to the IPA realm automatically and will proceed with the promotion step.
6d47df
 
6d47df
diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
6d47df
index aaa1943..3022057 100644
6d47df
--- a/ipaserver/install/server/replicainstall.py
6d47df
+++ b/ipaserver/install/server/replicainstall.py
6d47df
@@ -717,6 +717,11 @@ def ensure_enrolled(installer):
6d47df
         for ip in installer.ip_addresses:
6d47df
             # installer.ip_addresses is of type [CheckedIPAddress]
6d47df
             args.extend(("--ip-address", str(ip)))
6d47df
+    if installer.ntp_servers:
6d47df
+        for server in installer.ntp_servers:
6d47df
+            args.extend(("--ntp-server", server))
6d47df
+    if installer.ntp_pool:
6d47df
+        args.extend(("--ntp-pool", installer.ntp_pool))
6d47df
 
6d47df
     try:
6d47df
         # Call client install script
6d47df
@@ -774,6 +779,11 @@ def promote_check(installer):
6d47df
                   "the --domain, --server, --realm, --hostname, --password "
6d47df
                   "and --keytab options.")
6d47df
 
6d47df
+        # The NTP configuration can not be touched on pre-installed client:
6d47df
+        if options.no_ntp or options.ntp_servers or options.ntp_pool:
6d47df
+                raise ScriptError(
6d47df
+                    "NTP configuration cannot be updated during promotion")
6d47df
+
6d47df
     sstore = sysrestore.StateFile(paths.SYSRESTORE)
6d47df
 
6d47df
     fstore = sysrestore.FileStore(paths.SYSRESTORE)
6d47df