summaryrefslogtreecommitdiff
path: root/nova/cmd
diff options
context:
space:
mode:
authorSean Mooney <work@seanmooney.info>2022-09-02 13:42:15 +0100
committerSean Mooney <work@seanmooney.info>2022-09-02 13:42:15 +0100
commit6569de43a6482488afb620fd9dd43cb15b316cce (patch)
treeef5d6246fba92bb2875e9862ba018a7b7ef20e1a /nova/cmd
parent90e2a5e50fbf08e62a1aedd5e176845ee22d96c9 (diff)
downloadnova-6569de43a6482488afb620fd9dd43cb15b316cce.tar.gz
add header alingment for PrettyTable 3.4.0
In 3.3.0 the align attirbute applied to both the header and the data. In 3.4.0 align only applies to the data. This change restores the previous left align behavior for both header and data. Closes-Bug: #1988482 Change-Id: Ia77410b10c1706bc6561b11cf5d2ef72b936795e
Diffstat (limited to 'nova/cmd')
-rw-r--r--nova/cmd/manage.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/nova/cmd/manage.py b/nova/cmd/manage.py
index 08b8ebb310..45ae678ab4 100644
--- a/nova/cmd/manage.py
+++ b/nova/cmd/manage.py
@@ -122,6 +122,10 @@ def format_dict(dct, dict_property="Property", dict_value='Value',
"""
pt = prettytable.PrettyTable([dict_property, dict_value])
pt.align = 'l'
+ # starting in PrettyTable 3.4.0 we need to also set the header
+ # as align now only applies to the data.
+ if hasattr(pt, 'header_align'):
+ pt.header_align = 'l'
for k, v in sorted(dct.items(), key=sort_key):
# convert dict to str to check length
if isinstance(v, dict):