pgreco / rpms / ipa

Forked from forks/areguera/rpms/ipa 4 years ago
Clone
Blob Blame History Raw
From 56f6fe1df44bc9d3f434b0bccd44bc11cda89999 Mon Sep 17 00:00:00 2001
From: Florence Blanc-Renaud <flo@redhat.com>
Date: Tue, 2 Aug 2016 10:40:54 +0200
Subject: [PATCH] Fix ipa hbactest output

ipa hbactest command produces a Traceback (TypeError: cannot concatenate
'str' and 'bool' objects)
This happens because hbactest overrides output_for_cli but does not
properly handle the output for 'value' field. 'value' contains a boolean
but it should not be displayed (refer to ipalib/frontend.py,
Command.output_for_cli()).

Note that the issue did not appear before because the 'value' field
had a flag no_display.

https://fedorahosted.org/freeipa/ticket/6157

Reviewed-By: Martin Basti <mbasti@redhat.com>
---
 ipaclient/plugins/hbactest.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ipaclient/plugins/hbactest.py b/ipaclient/plugins/hbactest.py
index 2518719522c4eddff2e6bc341ee9a7c34b431938..1b54530b236cf654bc8ece7ab4e329850f5a6815 100644
--- a/ipaclient/plugins/hbactest.py
+++ b/ipaclient/plugins/hbactest.py
@@ -39,13 +39,15 @@ class hbactest(CommandOverride):
         # to be printed as our execute() method will return None for corresponding
         # entries and None entries will be skipped.
         for o in self.output:
+            if o == 'value':
+                continue
             outp = self.output[o]
             if 'no_display' in outp.flags:
                 continue
             result = output[o]
             if isinstance(result, (list, tuple)):
                 textui.print_attribute(unicode(outp.doc), result, '%s: %s', 1, True)
-            elif isinstance(result, (unicode, bool)):
+            elif isinstance(result, unicode):
                 if o == 'summary':
                     textui.print_summary(result)
                 else:
-- 
2.7.4