From b59fdaa9aa71f61230305a8f23e41c9c7c80e7b7 Mon Sep 17 00:00:00 2001 From: Slawek Kaplonski Date: Tue, 3 Dec 2019 10:09:06 +0100 Subject: [PATCH] Log exact error during getting value from file Before this patch function get_value_from_file() was only logging something like "Unable to access {filename}" but it would be useful sometimes to check what was exact reason of IOError so lets log this info also. TrivialFix Related-bug: #1853652 Change-Id: I28b1753a8d5767babbb6f06a581ffe1fc4ad75d3 --- neutron/agent/linux/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/neutron/agent/linux/utils.py b/neutron/agent/linux/utils.py index 7f8566f4110..228a1603760 100644 --- a/neutron/agent/linux/utils.py +++ b/neutron/agent/linux/utils.py @@ -257,8 +257,9 @@ def get_value_from_file(filename, converter=None): return converter(f.read()) if converter else f.read() except ValueError: LOG.error('Unable to convert value in %s', filename) - except IOError: - LOG.debug('Unable to access %s', filename) + except IOError as error: + LOG.debug('Unable to access %(filename)s; Error: %(error)s', + {'filename': filename, 'error': error}) def remove_conf_files(cfg_root, uuid):