Add required pool_id property to HealthMonitor

When I create a healthmonitor with a pool id by openstack sdk, there is an
error with the message "Failed to parse request. Required attribute
'pool_id' not specified", Then I find the code has no the parameter that
"pool_id".

I modify the healthmonitor class, I add a new line pool_id =
resource.Body('pool_id'), then successfully create a healthmonitor.

Change-Id: I95901152849341862333f1b3694c6265c43879ce
Closes-Bug: 1711546
This commit is contained in:
TingtingYu 2017-08-18 17:26:05 +08:00 committed by Brian Curtin
parent f6b01f86b2
commit a045f9741f
2 changed files with 4 additions and 0 deletions

View File

@ -51,6 +51,8 @@ class HealthMonitor(resource.Resource):
#: List of pools associated with this health monitor
#: *Type: list of dicts which contain the pool IDs*
pool_ids = resource.Body('pools', type=list)
#: The ID of the pool associated with this health monitor
pool_id = resource.Body('pool_id')
#: The ID of the project this health monitor is associated with.
project_id = resource.Body('tenant_id')
#: The maximum number of seconds for a monitor to wait for a

View File

@ -23,6 +23,7 @@ EXAMPLE = {
'id': IDENTIFIER,
'max_retries': '6',
'pools': [{'id': '7'}],
'pool_id': '7',
'tenant_id': '8',
'timeout': '9',
'type': '10',
@ -54,6 +55,7 @@ class TestHealthMonitor(testtools.TestCase):
self.assertEqual(EXAMPLE['id'], sot.id)
self.assertEqual(EXAMPLE['max_retries'], sot.max_retries)
self.assertEqual(EXAMPLE['pools'], sot.pool_ids)
self.assertEqual(EXAMPLE['pool_id'], sot.pool_id)
self.assertEqual(EXAMPLE['tenant_id'], sot.project_id)
self.assertEqual(EXAMPLE['timeout'], sot.timeout)
self.assertEqual(EXAMPLE['type'], sot.type)