File 0001-Restore-compatibility-with-PrettyTable-0.7.2-update.patch of Package python-novaclient
From 04acf3abacfbae806db6563308015eb5dd9262e8 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Mon, 29 Apr 2013 10:58:58 +0200
Subject: [PATCH] Restore compatibility with PrettyTable 0.7.2 update
This reverts commit 69f9971da54b46a8883148e4cef6346c7933b6ec
PrettyTable 0.7.2 defaults to print a table even if
the resultset is empty, which breaks the unit test and
also backward compatibilty. Restore previous behavior
to be in line with older prettytable releases.
Fixes bug 1166464
Change-Id: Ifaf5a91cefab1e85a35c5371793331c6bf83def4
---
novaclient/utils.py | 4 ++--
tests/test_shell.py | 6 +-----
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/novaclient/utils.py b/novaclient/utils.py
index 280bef0..c83a8d2 100644
--- a/novaclient/utils.py
+++ b/novaclient/utils.py
@@ -147,7 +147,7 @@ def print_list(objs, fields, formatters={}, sortby_index=0):
else:
sortby = fields[sortby_index]
mixed_case_fields = ['serverId']
- pt = prettytable.PrettyTable([f for f in fields], caching=False)
+ pt = prettytable.PrettyTable([f for f in fields], caching=False, print_empty=False)
pt.align = 'l'
for o in objs:
@@ -171,7 +171,7 @@ def print_list(objs, fields, formatters={}, sortby_index=0):
def print_dict(d, dict_property="Property", wrap=0):
- pt = prettytable.PrettyTable([dict_property, 'Value'], caching=False)
+ pt = prettytable.PrettyTable([dict_property, 'Value'], caching=False, print_empty=False)
pt.align = 'l'
for k, v in d.iteritems():
# convert dict to str to check length