URL: https://github.com/freeipa/freeipa/pull/829
Author: Tiboris
 Title: #829: client.py: Replace hardcoded 'admin' with options.principal
Action: synchronized

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/829/head:pr829
git checkout pr829
From e3a1c7563f70b5c339d8d225f39100309033e628 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tibor=20Dudl=C3=A1k?= <tdud...@redhat.com>
Date: Tue, 30 May 2017 14:36:00 +0200
Subject: [PATCH] client.py: Replace hardcoded 'admin' with options.principal

Fixes: https://pagure.io/freeipa/issue/5406
---
 ipaclient/install/client.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/ipaclient/install/client.py b/ipaclient/install/client.py
index 1aa50372a4..b30075ff26 100644
--- a/ipaclient/install/client.py
+++ b/ipaclient/install/client.py
@@ -2907,6 +2907,12 @@ def _install(options):
 
         # Check that nss is working properly
         if not options.on_master:
+            principal = options.principal
+            if principal is None:
+                principal = "admin"
+                root_logger.info("Principal is not set when enrolling with OTP"
+                                 "; using principal '%s' for 'getent passwd'",
+                                 principal)
             n = 0
             found = False
             # Loop for up to 10 seconds to see if nss is working properly.
@@ -2915,7 +2921,8 @@ def _install(options):
             # Particulary, SSSD might take longer than 6-8 seconds.
             while n < 10 and not found:
                 try:
-                    ipautil.run(["getent", "passwd", "admin@%s" % cli_domain])
+                    ipautil.run(["getent", "passwd", "%s@%s"
+                                % (principal, cli_domain)])
                     found = True
                 except Exception as e:
                     time.sleep(1)
@@ -2923,8 +2930,8 @@ def _install(options):
 
             if not found:
                 root_logger.error(
-                    "Unable to find 'admin' user with "
-                    "'getent passwd admin@%s'!" % cli_domain)
+                    "Unable to find '%s' user with 'getent passwd %s@%s'!"
+                    % (principal, principal, cli_domain))
                 if conf:
                     root_logger.info("Recognized configuration: %s", conf)
                 else:
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to