From 5e10b2eed29f845e079288c4aa9c8f59967d6dcc Mon Sep 17 00:00:00 2001 From: Martin Basti <mbasti@redhat.com> Date: Tue, 19 Apr 2016 18:47:25 +0200 Subject: Log errors from backup_and_replace hostname to logger Without logging errors to logger is hard to debug issue from logfile. https://fedorahosted.org/freeipa/ticket/5794 Reviewed-By: David Kupka <dkupka@redhat.com> --- ipaplatform/redhat/tasks.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ipaplatform') diff --git a/ipaplatform/redhat/tasks.py b/ipaplatform/redhat/tasks.py index bc7a9e389..ace29bd1c 100644 --- a/ipaplatform/redhat/tasks.py +++ b/ipaplatform/redhat/tasks.py @@ -332,8 +332,11 @@ class RedHatTaskNamespace(BaseTaskNamespace): try: self.set_hostname(hostname) except ipautil.CalledProcessError as e: - print(("Failed to set this machine hostname to " - "%s (%s)." % (hostname, str(e))), file=sys.stderr) + root_logger.debug(traceback.format_exc()) + root_logger.error( + "Failed to set this machine hostname to %s (%s).", + old_hostname, e + ) filepath = paths.ETC_HOSTNAME if os.path.exists(filepath): -- cgit