From ed008420e0549377f5f4e05bcbb2929c145cad1d Mon Sep 17 00:00:00 2001
From: Guido Trotter <ultrotter@google.com>
Date: Fri, 25 Sep 2009 15:11:08 +0100
Subject: [PATCH] Remove secrets and kill confd on cluster leave

Signed-off-by: Guido Trotter <ultrotter@google.com>
Reviewed-by: Michael Hanselmann <hansmi@google.com>
---
 lib/backend.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/backend.py b/lib/backend.py
index b0d7c71ec..24825c4c8 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -375,6 +375,18 @@ def LeaveCluster():
   except errors.OpExecError:
     logging.exception("Error while processing ssh files")
 
+  try:
+    utils.RemoveFile(constants.HMAC_CLUSTER_KEY)
+    utils.RemoveFile(constants.RAPI_CERT_FILE)
+    utils.RemoveFile(constants.SSL_CERT_FILE)
+  except:
+    logging.exception("Error while removing cluster secrets")
+
+  confd_pid = utils.ReadPidFile(utils.DaemonPidFileName(constants.CONFD))
+
+  if confd_pid:
+    utils.KillProcess(confd_pid, timeout=2)
+
   # Raise a custom exception (handled in ganeti-noded)
   raise errors.QuitGanetiException(True, 'Shutdown scheduled')
 
-- 
GitLab