summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2014-03-04 15:56:36 +0100
committerMichal Minar <miminar@redhat.com>2014-03-04 15:59:28 +0100
commit778f4799c09093dcd53fb40cd5b5bc0ae0759490 (patch)
tree9ac6361ce53fdb821e46af8f179d046582ceb6bc
parent1eefb88ca039aeec0ef83b13f1fcc392944467f7 (diff)
downloadopenlmi-scripts-778f4799c09093dcd53fb40cd5b5bc0ae0759490.tar.gz
openlmi-scripts-778f4799c09093dcd53fb40cd5b5bc0ae0759490.tar.xz
openlmi-scripts-778f4799c09093dcd53fb40cd5b5bc0ae0759490.zip
fixed duplicated header names in output
When there was NewTableCommand cmd produced by LmiLister it caused headers to be produced twice which is not desireable. Also turned off printing column names for Verify command of software scripts. Resolves trac ticket #287
-rw-r--r--commands/software/lmi/scripts/software/cmd.py2
-rw-r--r--lmi/scripts/common/formatter/__init__.py8
2 files changed, 7 insertions, 3 deletions
diff --git a/commands/software/lmi/scripts/software/cmd.py b/commands/software/lmi/scripts/software/cmd.py
index b747c1c..fd0dd29 100644
--- a/commands/software/lmi/scripts/software/cmd.py
+++ b/commands/software/lmi/scripts/software/cmd.py
@@ -315,7 +315,7 @@ class Remove(command.LmiCheckResult):
class Verify(command.LmiLister):
ARG_ARRAY_SUFFIX = '_array'
- COLUMNS = ('Result', 'Failed file path')
+ COLUMNS = []
def execute(self, ns, package_array):
failed_identity_checks = []
diff --git a/lmi/scripts/common/formatter/__init__.py b/lmi/scripts/common/formatter/__init__.py
index f081289..db7b7e3 100644
--- a/lmi/scripts/common/formatter/__init__.py
+++ b/lmi/scripts/common/formatter/__init__.py
@@ -326,7 +326,9 @@ class TableFormatter(ListFormatter):
:param string hostname: Hostname to print.
"""
- self.print_stash()
+ if len(self.stash):
+ # without a check, this would print headers for empty stash
+ self.print_stash()
super(TableFormatter, self).print_host(hostname)
def print_table_title(self, title):
@@ -335,7 +337,9 @@ class TableFormatter(ListFormatter):
:param string title: Title to print.
"""
- self.print_stash()
+ if len(self.stash):
+ # without a check, this would print headers for empty stash
+ self.print_stash()
if self.table_counter > 0 or self.line_counter > 0:
self.out.write('\n')
self.out.write("%s:\n" % title)