Skip to content

Commit 2dbbf56

Browse files
committed
Adapts new API response schema
This PR makes troveclient to handle API response in new data schema. Trove API response data schema has changed by the commit[1]. Original problem is that python-troveclient can't parse a API response data in new data schema, resulting in an error. [1]: https://opendev.org/openstack/trove/commit/429c39890e3242c6a502037673943b38452c5811 Task: 44986 Story: 2009979 Change-Id: I2e446c68c3b82c11d13f6bace54273c109e02069
1 parent ef88f4d commit 2dbbf56

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

troveclient/osc/v1/database_clusters.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ def set_attributes_for_print_detail(cluster):
3535
info['task_name'] = cluster.task['name']
3636
info.pop('task', None)
3737
if hasattr(cluster, 'ip'):
38-
info['ip'] = ', '.join(cluster.ip)
38+
ip = []
39+
for addr in cluster.ip:
40+
if isinstance(addr, dict):
41+
ip.append(addr['address'])
42+
else:
43+
ip.append(addr)
44+
info['ip'] = ', '.join(ip)
3945
instances = info.pop('instances', None)
4046
if instances:
4147
info['instance_count'] = len(instances)

0 commit comments

Comments
 (0)