From cac599f19a8f0c30b9dc92cb3792f1e3daec3835 Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Fri, 26 Feb 2010 10:03:54 +0100
Subject: [PATCH] Fix bug in LUQueryConfigValues

LUQueryConfigValues supports multiple output fields. If the client asked
for the watcher pause status, it would not get a list, but simply the
value.

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/cmdlib.py       | 2 +-
 scripts/gnt-cluster | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 519665cd7..a56f85774 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -3397,7 +3397,7 @@ class LUQueryConfigValues(NoHooksLU):
       elif field == "drain_flag":
         entry = os.path.exists(constants.JOB_QUEUE_DRAIN_FILE)
       elif field == "watcher_pause":
-        return utils.ReadWatcherPauseFile(constants.WATCHER_PAUSEFILE)
+        entry = utils.ReadWatcherPauseFile(constants.WATCHER_PAUSEFILE)
       else:
         raise errors.ParameterError(field)
       values.append(entry)
diff --git a/scripts/gnt-cluster b/scripts/gnt-cluster
index 53bea1a2c..22f28b7e7 100755
--- a/scripts/gnt-cluster
+++ b/scripts/gnt-cluster
@@ -206,6 +206,7 @@ def ShowClusterMaster(opts, args):
   ToStdout(master)
   return 0
 
+
 def _PrintGroupedParams(paramsdict):
   """Print Grouped parameters (be, nic, disk) by group.
 
@@ -218,6 +219,7 @@ def _PrintGroupedParams(paramsdict):
     for item, val in gr_dict.iteritems():
       ToStdout("      %s: %s", item, val)
 
+
 def ShowClusterConfig(opts, args):
   """Shows cluster information.
 
@@ -594,7 +596,7 @@ def WatcherOps(opts, args):
 
   elif command == "info":
     result = client.QueryConfigValues(["watcher_pause"])
-    _ShowWatcherPause(result)
+    _ShowWatcherPause(result[0])
 
   else:
     raise errors.OpPrereqError("Command '%s' is not valid." % command,
-- 
GitLab