From 14e15659381fc4a9ce268d58fc42b115d63fe42d Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 11 Oct 2007 14:55:10 +0000
Subject: [PATCH] Enable the ConfigWriter to keep track of updates

This allows external callers to determine if the configuration has been
changed.

Reviewed-by: imsnah
---
 lib/config.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/config.py b/lib/config.py
index b5d16bcc9..81b41e75c 100644
--- a/lib/config.py
+++ b/lib/config.py
@@ -48,6 +48,7 @@ class ConfigWriter:
 
   """
   def __init__(self, cfg_file=None, offline=False):
+    self.write_count = 0
     self._config_data = None
     self._config_time = None
     self._config_size = None
@@ -546,6 +547,7 @@ class ConfigWriter:
       f.close()
     # we don't need to do os.close(fd) as f.close() did it
     os.rename(name, destination)
+    self.write_count += 1
     # re-set our cache as not to re-read the config file
     try:
       st = os.stat(destination)
-- 
GitLab