From fe8d25537239f6309acc42c9a54042e21f196f7d Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 27 Feb 2012 14:40:44 +0100
Subject: [PATCH] Remove a superfluous warning in LUNodeRemove
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since we run the post-hooks explicitly in the Exec() function (via
_RunPostHook) after we removed the target node from the config, we
will get a:

  WARNING Node 'node2', which is about to be removed, was not found in
  the list of all nodes

in the logs every time we remove a node. The patch just removes the
warning, as actually invalid configurations (for the pre hook) will be
checked correctly elsewhere.

Additionally, the docstrings for BuildHooksEnv and BuildHooksNodes are
corrected/switched.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: RenΓ© Nussbaumer <rn@google.com>
---
 lib/cmdlib.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index d475b30db..e11645e55 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -4849,9 +4849,6 @@ class LUNodeRemove(LogicalUnit):
   def BuildHooksEnv(self):
     """Build hooks env.
 
-    This doesn't run on the target node in the pre phase as a failed
-    node would then be impossible to remove.
-
     """
     return {
       "OP_TARGET": self.op.node_name,
@@ -4861,13 +4858,15 @@ class LUNodeRemove(LogicalUnit):
   def BuildHooksNodes(self):
     """Build hooks nodes.
 
+    This doesn't run on the target node in the pre phase as a failed
+    node would then be impossible to remove.
+
     """
     all_nodes = self.cfg.GetNodeList()
     try:
       all_nodes.remove(self.op.node_name)
     except ValueError:
-      logging.warning("Node '%s', which is about to be removed, was not found"
-                      " in the list of all nodes", self.op.node_name)
+      pass
     return (all_nodes, all_nodes)
 
   def CheckPrereq(self):
-- 
GitLab