From 03db2832f1aea3f4f77f82d251df10337af2de25 Mon Sep 17 00:00:00 2001 From: Borne Mace Date: Wed, 31 May 2017 09:32:17 -0700 Subject: [PATCH] Hard bind cliff dependency and minor unicode fixes Newer versions of cliff have an issue where unicode strings are not handled correctly in output so we hard bind the requirements to a version of cliff we know doesn't have the problem. Also we were only doing the unicode translation when outputing to a table where there were are few other output formats where the translation was also appropriate. Change-Id: I04f7988f5ff01f7434687fade5465b87199b86ba --- kollacli/common/utils.py | 9 +++++---- requirements.txt | 4 ++-- tests/common.py | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/kollacli/common/utils.py b/kollacli/common/utils.py index 5135433..e1ac84e 100644 --- a/kollacli/common/utils.py +++ b/kollacli/common/utils.py @@ -1,4 +1,4 @@ -# Copyright(c) 2016, Oracle and/or its affiliates. All Rights Reserved. +# Copyright(c) 2017, Oracle and/or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -399,10 +399,11 @@ def convert_lists_to_string(tuples, parsed_args): (\u0414\u0435\u043a\u0430\u0442). By converting the list to string here, the proper non-ascii chars are displayed. - This will only change the lists when the output is to a table. It cannot - be changed if the display output is json, yaml, etc. + This will only change the lists when the output is to a user visible medium. + It cannot be changed if the display output is json, yaml, etc. """ - if parsed_args.formatter and parsed_args.formatter != 'table': + convert_types = ['table', 'csv', 'html', 'value'] + if parsed_args.formatter and parsed_args.formatter not in convert_types: # not table output, leave it as-is return tuples diff --git a/requirements.txt b/requirements.txt index 25a458c..116008f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ ansible>=1.9.2 Babel>=0.9.6 -cliff>=1.13.0 # Apache-2.0 -cliff-tablib>=1.1 +cliff==1.13.0 # Apache-2.0 +cliff-tablib<=1.1 jsonpickle>=0.9 oslo.i18n>=1.3.0 # Apache-2.0 paramiko>=1.15 diff --git a/tests/common.py b/tests/common.py index cd09fcf..241b1ef 100644 --- a/tests/common.py +++ b/tests/common.py @@ -348,7 +348,7 @@ class TestConfig(object): if hosts_info: for hostname, host_info in hosts_info.items(): uname = host_info['uname'] - pwd = host_info['pwd'] + pwd = host_info.get('pwd', '') self.add_host(hostname) self.set_password(hostname, pwd) self.set_username(hostname, uname)