From 6e7071d6add24e8923d705d35a362761f356d56d Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Jun 01 2017 07:24:24 +0000 Subject: py3: ConfigParser: replace deprecated readfd with read ConfigParser.readfd() is deprecated in py3, we can use .read() which is compatible with py2 https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Jan Cholasta Reviewed-By: Stanislav Laznicka --- diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 15ab659..04bf4fc 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -749,10 +749,9 @@ def read_replica_info(dir_path, rconfig): rconfig is a ReplicaConfig object """ - filename = dir_path + "/realm_info" - fd = open(filename) + filename = os.path.join(dir_path, "realm_info") config = SafeConfigParser() - config.readfp(fd) + config.read(filename) rconfig.realm_name = config.get("realm", "realm_name") rconfig.master_host_name = config.get("realm", "master_host_name") diff --git a/ipaserver/install/ipa_restore.py b/ipaserver/install/ipa_restore.py index ea308db..d85c487 100644 --- a/ipaserver/install/ipa_restore.py +++ b/ipaserver/install/ipa_restore.py @@ -711,9 +711,8 @@ class Restore(admintool.AdminTool): Read the backup file header that contains the meta data about this particular backup. ''' - with open(self.header) as fd: - config = SafeConfigParser() - config.readfp(fd) + config = SafeConfigParser() + config.read(self.header) self.backup_type = config.get('ipa', 'type') self.backup_time = config.get('ipa', 'time')