Fix --no-headers for the new list-drbd command
authorIustin Pop <iustin@google.com>
Thu, 19 Jul 2012 08:31:52 +0000 (10:31 +0200)
committerIustin Pop <iustin@google.com>
Thu, 19 Jul 2012 09:22:39 +0000 (11:22 +0200)
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

index 005501a..cbf9883 100644 (file)
@@ -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),