Hi,

this patch fixes issue 1) of the following ticket:
Uninstallation complains about missing 'ipa.conf'

Issue 2) is not reproducible on the master, and issue 3) is handled in a separate ticket.

https://fedorahosted.org/freeipa/ticket/6012
>From 01f8955634e8dbdc9a976ac72250aa38c1969b3c Mon Sep 17 00:00:00 2001
From: Florence Blanc-Renaud <fren...@redhat.com>
Date: Thu, 30 Jun 2016 09:15:45 +0200
Subject: [PATCH] Do not log error when removing a non-existing file

When the uninstaller tries to remove /etc/systemd/system/httpd.d/ipa.conf and
the file does not exist, only log to debug instead of error.

https://fedorahosted.org/freeipa/ticket/6012
---
 ipaplatform/redhat/tasks.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
index 294a9fe1abe48423495cf6207288c78bbd00b02e..8ac88511e94d640f077c7a0e202bc545ec8bcbbe 100644
--- a/ipaplatform/redhat/tasks.py
+++ b/ipaplatform/redhat/tasks.py
@@ -29,6 +29,7 @@ import os
 import socket
 import base64
 import traceback
+import errno
 
 from cffi import FFI
 from ctypes.util import find_library
@@ -466,10 +467,16 @@ class RedHatTaskNamespace(BaseTaskNamespace):
         try:
             os.unlink(paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF)
         except OSError as e:
-            root_logger.error(
-                'Error removing %s: %s',
-                paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF, e
-            )
+            if e.errno == errno.ENOENT:
+                root_logger.debug(
+                    'Trying to remove %s but file does not exist',
+                    paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF
+                )
+            else:
+                root_logger.error(
+                    'Error removing %s: %s',
+                    paths.SYSTEMD_SYSTEM_HTTPD_IPA_CONF, e
+                )
 
     def set_hostname(self, hostname):
         ipautil.run([paths.BIN_HOSTNAMECTL, 'set-hostname', hostname])
-- 
2.7.4

-- 
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

Reply via email to