From 19e1b71523c2b7354708b4338647b810ff68e24f Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Wed, 26 Dec 2012 13:10:23 +0100
Subject: [PATCH] Return master ip script output in case of failure
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Currently only the exit code is returned, which is somewhat pointless:
for failures, we already know it's β‰  0, so we don't have enough
information (reported on the mailing list). By logging the output as
well (if any), the user will have more information available for
debugging.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/backend.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/backend.py b/lib/backend.py
index c9027189e..47a941f97 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -358,8 +358,8 @@ def _RunMasterSetupScript(master_params, action, use_external_mip_script):
   result = utils.RunCmd([setup_script, action], env=env, reset_env=True)
 
   if result.failed:
-    _Fail("Failed to %s the master IP. Script return value: %s" %
-          (action, result.exit_code), log=True)
+    _Fail("Failed to %s the master IP. Script return value: %s, output: '%s'" %
+          (action, result.exit_code, result.output), log=True)
 
 
 @RunLocalHooks(constants.FAKE_OP_MASTER_TURNUP, "master-ip-turnup",
-- 
GitLab