Length limitation added for vip name in network roles

Only 13 symbols of vip name used in vip_generation:
https://review.openstack.org/#/c/215270/18/deployment/puppet/osnailyfacter/lib/puppet/parser/functions/generate_vips.rb,cm
So for pervention name collisions we limit vip name by 13 symbols
in network roles JSON schema.

Change-Id: I749ed7baa712c9ae9c4129702621999ade232987
Closes-Bug: #1488471
This commit is contained in:
Alexander Kislitsky 2015-08-26 17:14:47 +03:00
parent c30c74c114
commit 5b7e4e32c8
2 changed files with 20 additions and 0 deletions

View File

@ -433,3 +433,22 @@ class TestValidatorV3(BaseValidator):
"File '/tmp/plugin_path/network_roles.yaml',"
" 'hap roxy' does not match"):
self.validator.check_network_roles_schema()
@mock.patch('fuel_plugin_builder.validators.base.utils')
def test_check_network_roles_name_length(self, utils_mock):
vip_name = 'a' * 14
utils_mock.parse_yaml.return_value = [{
"id": "example_net_role",
"default_mapping": "public",
"properties": {
"subnet": True,
"gateway": False,
"vip": [{
"name": vip_name,
"namespace": "haproxy"}]}}]
with self.assertRaisesRegexp(
errors.ValidationError,
"File '/tmp/plugin_path/network_roles.yaml',"
" '%s' is too long" % vip_name):
self.validator.check_network_roles_schema()

View File

@ -193,6 +193,7 @@ class SchemaV3(SchemaV2):
'properties': {
'name': {
'type': 'string',
'maxLength': 13,
'pattern': NETWORK_ROLE_PATTERN},
'namespace': {
'type': 'string',