Hello,

Treat error during write to /etc/resolv.conf as non-fatal.

https://fedorahosted.org/freeipa/ticket/4110

--
Petr^2 Spacek
From 23104ca67953c0346005567af2710c29689980d5 Mon Sep 17 00:00:00 2001
From: Petr Spacek <pspa...@redhat.com>
Date: Tue, 14 Jan 2014 10:48:31 +0100
Subject: [PATCH] Treat error during write to /etc/resolv.conf as non-fatal.

https://fedorahosted.org/freeipa/ticket/4110
---
 ipaserver/install/bindinstance.py | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 6d5a1d44d30c89278c24fe7ab5278355cb65b0b4..fad48e1f86804e284d668e2a94dd98db3bd47686 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -810,11 +810,14 @@ class BindInstance(service.Service):
     def __setup_resolv_conf(self):
         self.fstore.backup_file(RESOLV_CONF)
         resolv_txt = "search "+self.domain+"\nnameserver "+self.ip_address+"\n"
-        resolv_fd = open(RESOLV_CONF, 'w')
-        resolv_fd.seek(0)
-        resolv_fd.truncate(0)
-        resolv_fd.write(resolv_txt)
-        resolv_fd.close()
+        try:
+            resolv_fd = open(RESOLV_CONF, 'w')
+            resolv_fd.seek(0)
+            resolv_fd.truncate(0)
+            resolv_fd.write(resolv_txt)
+            resolv_fd.close()
+        except IOError as e:
+            root_logger.error('Could not write to resolv.conf: %s' % str(e))
 
     def add_master_dns_records(self, fqdn, ip_address, realm_name, domain_name,
                                reverse_zone, ntp=False, ca_configured=None):
-- 
1.8.4.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to