cfgupgrade: Remove old watcher state file
authorMichael Hanselmann <hansmi@google.com>
Fri, 29 Jul 2011 13:15:00 +0000 (15:15 +0200)
committerMichael Hanselmann <hansmi@google.com>
Thu, 4 Aug 2011 10:28:33 +0000 (12:28 +0200)
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

tools/cfgupgrade

index 0d341c3..487969a 100755 (executable)
@@ -127,6 +127,7 @@ def main():
   options.CONFD_HMAC_KEY = options.data_dir + "/hmac.key"
   options.CDS_FILE = options.data_dir + "/cluster-domain-secret"
   options.SSCONF_MASTER_NODE = options.data_dir + "/ssconf_master_node"
+  options.WATCHER_STATEFILE = options.data_dir + "/watcher.data"
 
   SetupLogging()
 
@@ -206,6 +207,12 @@ def main():
     if not options.dry_run:
       os.symlink(options.RAPI_USERS_FILE, options.RAPI_USERS_FILE_PRE24)
 
+  # Remove old watcher state file if it exists
+  if os.path.exists(options.WATCHER_STATEFILE):
+    logging.info("Removing watcher state file %s", options.WATCHER_STATEFILE)
+    if not options.dry_run:
+      utils.RemoveFile(options.WATCHER_STATEFILE)
+
   try:
     logging.info("Writing configuration file to %s", options.CONFIG_DATA_PATH)
     utils.WriteFile(file_name=options.CONFIG_DATA_PATH,