From c7b46d5930e6617304089334e03b9fb692d45d4b Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Mon, 5 Nov 2007 17:59:53 +0000
Subject: [PATCH] Handle missing init script at cluster init

This patch adds a check in the prereq of LUInitCluster for the existence
of the init script.  This allows a clean abort instead of a stack dump.

Based on a report by admin@steibei.net

Reviewed-by: ultrotter
---
 lib/cmdlib.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 6bd0ed03e..c77a7a52a 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -611,6 +611,11 @@ class LUInitCluster(LogicalUnit):
                                  (self.op.master_netdev,
                                   result.output.strip()))
 
+    if not os.path.exists(constants.NODE_INITD_SCRIPT):
+      raise errors.OpPrereqError("Missing init.d script '%s'. Please reinstall"
+                                 " or install the script manually." %
+                                 constants.NODE_INITD_SCRIPT)
+
   def Exec(self, feedback_fn):
     """Initialize the cluster.
 
-- 
GitLab