summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLingxian Kong <anlin.kong@gmail.com>2020-12-23 13:21:55 +1300
committerLingxian Kong <anlin.kong@gmail.com>2020-12-23 13:29:41 +1300
commit961ef31807bb273635e66c0ec0058340e559224d (patch)
tree8455b0502213650ad775d576028a9d113e847133
parent77023b350e8d969eb8ed3d3382c87cfd52f94b3f (diff)
downloadpython-troveclient-961ef31807bb273635e66c0ec0058340e559224d.tar.gz
Fix getting server id for listing instances
Just use 'server_id' from the instance response instead. Story: 2008464 Task: 41496 Change-Id: Ib84dbd5fbd752ab7c7607ccb874663b01bfb7388
-rw-r--r--troveclient/osc/v1/database_instances.py3
-rw-r--r--troveclient/tests/osc/v1/test_database_instances.py2
2 files changed, 2 insertions, 3 deletions
diff --git a/troveclient/osc/v1/database_instances.py b/troveclient/osc/v1/database_instances.py
index 4f69975..5e54898 100644
--- a/troveclient/osc/v1/database_instances.py
+++ b/troveclient/osc/v1/database_instances.py
@@ -56,9 +56,6 @@ def get_instances_info(instances):
if 'addresses' not in instance_info:
instance_info['addresses'] = ''
- if 'server' in instance_info:
- instance_info['server_id'] = instance_info['server'].get('id')
-
if 'operating_status' not in instance_info:
# In case newer version python-troveclient is talking to older
# version trove.
diff --git a/troveclient/tests/osc/v1/test_database_instances.py b/troveclient/tests/osc/v1/test_database_instances.py
index e6c84a7..001f04d 100644
--- a/troveclient/tests/osc/v1/test_database_instances.py
+++ b/troveclient/tests/osc/v1/test_database_instances.py
@@ -109,6 +109,7 @@ class TestInstanceList(TestInstances):
},
"tenant_id": tenant_id,
"access": {"is_public": False, "allowed_cidrs": []},
+ "server_id": server_id,
'server': {
'id': server_id
}
@@ -157,6 +158,7 @@ class TestInstanceList(TestInstances):
},
"tenant_id": tenant_id,
"access": {"is_public": False, "allowed_cidrs": []},
+ "server_id": server_id,
'server': {
'id': server_id
}