From ebef4d147751ce4346b6bf22112b17156f0626e9 Mon Sep 17 00:00:00 2001 From: Stepan Blyshchak Date: Mon, 2 Nov 2020 16:27:23 +0200 Subject: [PATCH] [hostcfgd] if entry not in the cache put a default state Our use case is to register new features in runtime. The previous change which introduced the cache broke this capability and caused hostcfgd crash. Signed-off-by: Stepan Blyshchak --- files/image_config/hostcfgd/hostcfgd | 2 ++ 1 file changed, 2 insertions(+) diff --git a/files/image_config/hostcfgd/hostcfgd b/files/image_config/hostcfgd/hostcfgd index 9c86cedc7db6..75086b45fe1a 100755 --- a/files/image_config/hostcfgd/hostcfgd +++ b/files/image_config/hostcfgd/hostcfgd @@ -368,6 +368,8 @@ class HostConfigDaemon: syslog.syslog(syslog.LOG_WARNING, "Enable state of feature '{}' is None".format(feature_name)) return + self.cached_feature_states.setdefault(feature_name, 'disabled') + # Enable/disable the container service if the feature state was changed from its previous state. if self.cached_feature_states[feature_name] != state: self.cached_feature_states[feature_name] = state