Hi All,
Please review this patch.
Thanks for mbasti for helping me.
Thanks,
Abhijeet Kasurde
From 402fa7f09fe7a470044c1f5c1c10699cad75100f Mon Sep 17 00:00:00 2001
From: Abhijeet Kasurde
Date: Thu, 5 May 2016 17:58:09 +0530
Subject: [PATCH] Replaced find_hostname with api.env.host
Fixes: https://fedorahosted.org/freeipa/ticket/5841
Signed-off-by: Abhijeet Kasurde
---
ipaserver/install/server/upgrade.py | 22 +-
1 file changed, 1 insertion(+), 21 deletions(-)
diff --git a/ipaserver/install/server/upgrade.py b/ipaserver/install/server/upgrade.py
index 4f3a2cb065319a26bfa517b4d1d2cb4b41fb486d..38fe2c3e89da55faa30c624983cb8f9c630357b3 100644
--- a/ipaserver/install/server/upgrade.py
+++ b/ipaserver/install/server/upgrade.py
@@ -94,23 +94,6 @@ def update_conf(sub_dict, filename, template_filename):
fd.write(template)
fd.close()
-def find_hostname():
-"""Find the hostname currently configured in ipa-rewrite.conf"""
-filename=paths.HTTPD_IPA_REWRITE_CONF
-
-if not ipautil.file_exists(filename):
-return None
-
-pattern = "^[\s#]*.*https:\/\/([A-Za-z0-9\.\-]*)\/.*"
-p = re.compile(pattern)
-for line in fileinput.input(filename):
-if p.search(line):
-fileinput.close()
-return p.search(line).group(1)
-fileinput.close()
-
-raise RuntimeError("Unable to determine the fully qualified hostname from %s" % filename)
-
def find_autoredirect(fqdn):
"""
When upgrading ipa-rewrite.conf we need to see if the automatic redirect
@@ -1437,10 +1420,7 @@ def upgrade_configuration():
fstore = sysrestore.FileStore(paths.SYSRESTORE)
-fqdn = find_hostname()
-if fqdn is None:
-# ipa-rewrite.conf doesn't exist, nothing to do
-raise RuntimeError("ipa-rewrite.conf doesn't exists (is this server?)")
+fqdn = api.env.host
# Ok, we are an IPA server, do the additional tests
ds_serverid = installutils.realm_to_serverid(api.env.realm)
--
2.4.11
--
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