Fix system cluster-show error updating string encoding
When it was executed 'system cluster-show <uuid or name>' on a storage config, the error message "'str' object has no attribute 'decode'" showed. The error was caused because in upgrading from python 2 to 3 there were changes in the string encoding. In the latest version, there is no possibility to 'decode' a string, and then it's necessary to remove it to ensure correct display of cluster information. Test Plan: Pass: Storage, cluster-show command return proper info. Pass: Standard, cluster-show command return proper info. Closes-Bug: 1998599 Signed-off-by: Gabriel de Araújo Cabral <gabriel.cabral@windriver.com> Change-Id: Ia09bb5fc6c1c746a51d0be2093115e29eb5c3faf
This commit is contained in:
parent
6b6fa219bd
commit
4a1fe61f6c
|
@ -19,7 +19,7 @@ def _peer_formatter(values):
|
|||
for value in values:
|
||||
name = value.get('name')
|
||||
hosts = value.get('hosts')
|
||||
hosts = [x.decode('unicode_escape').encode('ascii', 'ignore')
|
||||
hosts = [x.encode('ascii', 'ignore')
|
||||
for x in hosts]
|
||||
result.append(str(name) + ":" + str(hosts))
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ from cgtsclient.v1 import storage_backend as storage_backend_utils
|
|||
|
||||
def _list_formatter(values):
|
||||
if values is not None:
|
||||
result = [x.decode('unicode_escape').encode('ascii', 'ignore')
|
||||
result = [x.encode('ascii', 'ignore')
|
||||
for x in values]
|
||||
return (", ".join(result))
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue