From d9a6c5f3901e078a30d341397ac57d867d8191cc Mon Sep 17 00:00:00 2001 From: Dawud M Date: Wed, 15 Feb 2023 18:02:05 +0000 Subject: Add comprehensive checks for container restarts When adding a dashboard to grafana the containers aren't restarted when they should be. This is due to a bug in Kolla where the logic to determine whether or the container needs to be restarted fails in the case where the file does not exist in the container. This patch adds more comprehensive checks for container restarts in the set_configs.py file. This patch also adds a test to ensure that the functions work as expected. Closes-Bug: #1997984 Co-Authored-By: Will Szumski Change-Id: I67f5f12700d7b55f26bff81e9b54559303da6d83 --- docker/base/set_configs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docker') diff --git a/docker/base/set_configs.py b/docker/base/set_configs.py index 559f1c0f3..40c3e5162 100644 --- a/docker/base/set_configs.py +++ b/docker/base/set_configs.py @@ -162,9 +162,11 @@ class ConfigFile(object): def _cmp_file(self, source, dest): # check exsit if (os.path.exists(source) and - not self.optional and not os.path.exists(dest)): return False + if (os.path.exists(dest) and + not os.path.exists(source)): + return False # check content with open(source, 'rb') as f1, open(dest, 'rb') as f2: if f1.read() != f2.read(): -- cgit v1.2.3