From 8e3027c5427ecfb89fe48ad38eb8189b1608d0fc Mon Sep 17 00:00:00 2001 From: Radosław Piliszek Date: Sun, 31 Jan 2021 17:09:04 +0100 Subject: Make kolla_set_configs open files in binary mode This fixes comparisons when files are not Unicode-encoded. A relevant unit test is included. It can be used as a base for other _cmp_file method unit tests if the need arises. Change-Id: Ic638516eb92d24ad247a7866fd1b5e2ac0400388 Closes-Bug: #1913952 --- docker/base/set_configs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docker') diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 572e4a001..0cb0e414c 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -164,7 +164,7 @@ class ConfigFile(object): not os.path.exists(dest)): return False # check content - with open(source) as f1, open(dest) as f2: + with open(source, 'rb') as f1, open(dest, 'rb') as f2: if f1.read() != f2.read(): LOG.error('The content of source file(%s) and' ' dest file(%s) are not equal.', source, dest) -- cgit v1.2.3