summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorence Blanc-Renaud <frenaud@redhat.com>2016-06-30 09:15:45 +0200
committerMartin Basti <mbasti@redhat.com>2016-07-01 09:01:21 +0200
commitd9ae9ee1b5397765ba7f184c7647bd36708ca0e8 (patch)
tree496f63250880cf97a42693e35e571c4da8b02779
parent3ac3882631564cd774114e61e607fffdbd667eee (diff)
downloadfreeipa-d9ae9ee1b5397765ba7f184c7647bd36708ca0e8.zip
freeipa-d9ae9ee1b5397765ba7f184c7647bd36708ca0e8.tar.gz
freeipa-d9ae9ee1b5397765ba7f184c7647bd36708ca0e8.tar.xz
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 Reviewed-By: Martin Basti <mbasti@redhat.com>
-rw-r--r--ipaplatform/redhat/tasks.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py
index 294a9fe..8ac8851 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])