diff --git a/magnum/api/controllers/v1/bay.py b/magnum/api/controllers/v1/bay.py index 7bb1a112ee..ae42847f81 100644 --- a/magnum/api/controllers/v1/bay.py +++ b/magnum/api/controllers/v1/bay.py @@ -83,9 +83,10 @@ class Bay(base.APIBase): uuid = types.uuid """Unique UUID for this bay""" - name = wtypes.StringType(min_length=1, max_length=255, + name = wtypes.StringType(min_length=1, max_length=242, pattern='^[a-zA-Z][a-zA-Z0-9_.-]*$') - """Name of this bay""" + """Name of this bay, max length is limited to 242 because of heat stack + requires max length limit to 255, and Magnum amend a uuid length""" baymodel_id = wsme.wsproperty(wtypes.text, _get_baymodel_id, _set_baymodel_id, mandatory=True) diff --git a/magnum/tests/unit/api/controllers/v1/test_bay.py b/magnum/tests/unit/api/controllers/v1/test_bay.py index b5d9fd28f1..1f1306d7a1 100644 --- a/magnum/tests/unit/api/controllers/v1/test_bay.py +++ b/magnum/tests/unit/api/controllers/v1/test_bay.py @@ -532,7 +532,7 @@ class TestPost(api_base.FunctionalTest): self.assertEqual(1, response.json['master_count']) def test_create_bay_with_invalid_long_name(self): - bdict = apiutils.bay_post_data(name='x' * 256) + bdict = apiutils.bay_post_data(name='x' * 243) response = self.post_json('/bays', bdict, expect_errors=True) self.assertEqual('application/json', response.content_type) self.assertEqual(400, response.status_int)