From 2207afc9b9306c19785238f8f02642187f807785 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Fri, 24 Jan 2020 10:18:47 -0700 Subject: Add error message when merge fails If the source cfg directory contains a path (e.g. /etc/pki/ca-trust/extracted/) which is also bind mounted into the container as read-only, when it attempts to merge the paths together the resulting exception doesn't really indicate what happened. Change-Id: I73bbfd31586012e1fd64d30f9ce1d7eb2256d210 Related-Bug: #1860607 --- docker/base/set_configs.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'docker/base') diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 9176a510d..93a758f1d 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -147,7 +147,15 @@ class ConfigFile(object): if not self.merge: self._delete_path(dest) self._create_parent_dirs(dest) - self._merge_directories(source, dest) + try: + self._merge_directories(source, dest) + except OSError: + # If a source is tried to merge with a read-only mount, it + # may throw an OSError. Because we don't print the source or + # dest anywhere, let's catch the exception and log a better + # message to help with tracking down the issue. + LOG.error('Unable to merge %s with %s', source, dest) + raise def _cmp_file(self, source, dest): # check exsit -- cgit v1.2.3