From fee9556cf1a3fc2a21190e8f0c250978a97df5a4 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Fri, 3 Aug 2007 12:51:42 +0000
Subject: [PATCH] Re-stat the config file when we write it so that the next
 _OpenConfig() won't reread it if not modified by someone else.

---
 lib/config.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/config.py b/lib/config.py
index e4d948f4b..fcfac9ecc 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -545,6 +545,15 @@ class ConfigWriter:
       f.close()
     # we don't need to do os.close(fd) as f.close() did it
     os.rename(name, destination)
+    # re-set our cache as not to re-read the config file
+    try:
+      st = os.stat(destination)
+    except OSError, err:
+      raise errors.ConfigurationError, "Can't stat config file: %s" % err
+    self._config_time = st.st_mtime
+    self._config_size = st.st_size
+    self._config_inode = st.st_ino
+    # and redistribute the config file
     self._DistributeConfig()
 
   def InitConfig(self, node, primary_ip, secondary_ip,
-- 
GitLab