Allow segment description to be multiline

This patch allows user to pass a multiline description for
a failover segment.

Closes-Bug: #1776385
Change-Id: I25afb76aec10a507312b8d99b0c882ca9f6bcd81
This commit is contained in:
nirajsingh 2018-06-12 09:54:17 +05:30 committed by Radosław Piliszek
parent 7f76081ccf
commit d7f47f2627
3 changed files with 21 additions and 1 deletions

View File

@ -116,7 +116,7 @@ def _build_regex_range(ws=True, invert=False, exclude=None):
return regex
valid_description_regex_base = '^[%s]*$'
valid_description_regex_base = '^[\n%s]*$'
valid_name_regex_base = '^(?![%s])[%s]*(?<![%s])$'

View File

@ -130,6 +130,21 @@ class FailoverSegmentTestCase(test.TestCase):
result = result['segment']
self._assert_segment_data(FAILOVER_SEGMENT, _make_segment_obj(result))
@mock.patch.object(ha_api.FailoverSegmentAPI, 'create_segment')
def test_create_with_multiline_description(self, mock_create):
body = {
"segment": {
"name": "segment1",
"service_type": "COMPUTE",
"recovery_method": "auto",
"description": "failover_segment\nfor\ncompute"
}
}
mock_create.return_value = FAILOVER_SEGMENT
result = self.controller.create(self.req, body=body)
result = result['segment']
self._assert_segment_data(FAILOVER_SEGMENT, _make_segment_obj(result))
@mock.patch.object(ha_api.FailoverSegmentAPI, 'create_segment')
def test_create_with_duplicate_segment_name(self, mock_create):
body = {

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Allows segment description to contain new line characters.
`LP#1776385 <https://launchpad.net/bugs/1776385>`__