From 02b31f3219674fc8411d4e08dc8b7b4e0c6d5bdb Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 5 Dec 2008 02:42:18 +0000
Subject: [PATCH] ssconf: empty files should not add a newline

Currently we add a newline in the ssconf writeout process, even if the
file is empty. We chage this case so that lists of values (e.g. offline
nodes) are correct (not a list of one empty element).

Reviewed-by: imsnah
---
 lib/ssconf.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/ssconf.py b/lib/ssconf.py
index f369c60df..c36aa65c9 100644
--- a/lib/ssconf.py
+++ b/lib/ssconf.py
@@ -185,7 +185,7 @@ class SimpleStore(object):
     ssconf_lock.Exclusive(blocking=True, timeout=SSCONF_LOCK_TIMEOUT)
     try:
       for name, value in values.iteritems():
-        if not value.endswith("\n"):
+        if value and not value.endswith("\n"):
           value += "\n"
         utils.WriteFile(self.KeyToFilename(name), data=value)
     finally:
-- 
GitLab