[lxc-devel] [lxd/master] Log a warning for unknown config keys and don't crash

albertodonato on Github lxc-bot at linuxcontainers.org
Mon Jul 31 13:22:09 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 301 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170731/7233e368/attachment.bin>
-------------- next part --------------
From 9d4447465b86ef8d0233842947cef4ffe97d53b9 Mon Sep 17 00:00:00 2001
From: Alberto Donato <alberto.donato at canonical.com>
Date: Mon, 31 Jul 2017 15:21:36 +0200
Subject: [PATCH] Log a warning for unknown config keys and don't crash.

Signed-off-by: Alberto Donato <alberto.donato at canonical.com>
---
 lxd/daemon_config.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lxd/daemon_config.go b/lxd/daemon_config.go
index 15c55a429..6e9a78085 100644
--- a/lxd/daemon_config.go
+++ b/lxd/daemon_config.go
@@ -210,7 +210,8 @@ func daemonConfigInit(db *sql.DB) error {
 	for k, v := range dbValues {
 		_, ok := daemonConfig[k]
 		if !ok {
-			logger.Error("Found invalid configuration key in database", log.Ctx{"key": k})
+			logger.Warn("Found unknown configuration key in database", log.Ctx{"key": k})
+			break
 		}
 
 		daemonConfig[k].currentValue = v


More information about the lxc-devel mailing list