Add default value to pool-prefix in Subnet-pool

If user tries to create a subnet pool without --pool-prefix,
it fails at the NeutronServer [1].
This patch tries to add a default value to the --pool-prefix
to try and resolve it.

Closes-Bug: #1564271
[1] : http://paste.openstack.org/show/492537/

Change-Id: I6cf324a5a8037048602e59c0bbfc93b40e73a74e
This commit is contained in:
reedip 2016-03-31 17:33:32 +09:00 committed by Reedip
parent a1a470693e
commit 7027d915b5
2 changed files with 4 additions and 0 deletions

View File

@ -111,6 +111,9 @@ class CreateSubnetPool(command.ShowOne):
def take_action(self, parsed_args):
client = self.app.client_manager.network
attrs = _get_attrs(self.app.client_manager, parsed_args)
# NeutronServer expects prefixes to be a List
if "prefixes" not in attrs:
attrs['prefixes'] = []
obj = client.create_subnet_pool(**attrs)
columns = _get_columns(obj)
data = utils.get_item_properties(obj, columns, formatters=_formatters)

View File

@ -149,6 +149,7 @@ class TestCreateSubnetPool(TestSubnetPool):
'default_prefixlen': self._subnet_pool.default_prefixlen,
'max_prefixlen': self._subnet_pool.max_prefixlen,
'min_prefixlen': self._subnet_pool.min_prefixlen,
'prefixes': [],
'name': self._subnet_pool.name,
})
self.assertEqual(self.columns, columns)