From 2da311813cfe994ff232052fe9637633e98ea395 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Thu, 19 Jul 2012 10:31:52 +0200
Subject: [PATCH] Fix --no-headers for the new list-drbd command
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Sorry, I forgot that with GenerateTable this needs to be handled
manually. Fixed now and tested in both ways.

(But to be honest, this should be abstracted in GenerateTable, instead
of the 'if' test in all its callers.)

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

diff --git a/lib/client/gnt_node.py b/lib/client/gnt_node.py
index 005501a9c..cbf98832e 100644
--- a/lib/client/gnt_node.py
+++ b/lib/client/gnt_node.py
@@ -960,8 +960,11 @@ def ListDrbd(opts, args):
     return constants.EXIT_FAILURE
 
   fields = ["node", "minor", "instance", "disk", "role", "peer"]
-  headers = {"node": "Node", "minor": "Minor", "instance": "Instance",
-             "disk": "Disk", "role": "Role", "peer": "PeerNode"}
+  if opts.no_headers:
+    headers = None
+  else:
+    headers = {"node": "Node", "minor": "Minor", "instance": "Instance",
+               "disk": "Disk", "role": "Role", "peer": "PeerNode"}
 
   data = GenerateTable(separator=opts.separator, headers=headers,
                        fields=fields, data=sorted(status.answer),
-- 
GitLab