Fix breaking in code if extra_pools is passed as None
The code currently assumes that a empty list will be passed rather than None, so this change defensively codes against a None being passed (deserialised from json) so that it is correctly parsed as "no extra pools". Also modified the test to push None to the function to verify that it handles the situation Change-Id: I27220696f64b65280f24cab2328e1366fcbbdf4f Closes-Bug: #1897574
This commit is contained in:
parent
771981e23f
commit
272abf6e55
@ -750,7 +750,7 @@ def handle_create_cephfs(request, service):
|
||||
"""
|
||||
cephfs_name = request.get('mds_name')
|
||||
data_pool = request.get('data_pool')
|
||||
extra_pools = request.get('extra_pools', [])
|
||||
extra_pools = request.get('extra_pools', None) or []
|
||||
metadata_pool = request.get('metadata_pool')
|
||||
# Check if the user params were provided
|
||||
if not cephfs_name or not data_pool or not metadata_pool:
|
||||
|
@ -478,6 +478,7 @@ class CephBrokerTestCase(unittest.TestCase):
|
||||
'mds_name': 'foo',
|
||||
'data_pool': 'data',
|
||||
'metadata_pool': 'metadata',
|
||||
'extra_pools': None,
|
||||
}]})
|
||||
rc = charms_ceph.broker.process_requests(reqs)
|
||||
mock_pool_exists.assert_has_calls(
|
||||
|
Loading…
Reference in New Issue
Block a user